Skip to content
Code-Schnipsel Gruppen Projekte
Timeline.php 1,22 KiB
Newer Older
<?php

/**
 * This file contains QUI\Timeline\Bricks\Timeline
 */

namespace QUI\Timeline\Bricks;

use QUI;

/**
 * Class Timeline
 *
 * @package quiqqer/timeline
 */
class Timeline extends QUI\Control
{

    /**
     * constructor
     *
     * @param array $attributes
     */
    public function __construct($attributes = [])
    {
        // default options
        $this->setAttributes([
            'image' => 'original', // original, cover
        ]);

        parent::__construct($attributes);

        $this->setAttribute('cacheable', 0);
    }

    /**
     * Return the inner body of the element
     * Can be overwritten
     *
     * @return String
     */
    public function getBody()
    {
        $Engine  = QUI::getTemplateManager()->getEngine();
        $Control = new QUI\Timeline\Controls\Timeline();

        $Control->setAttribute('parentInputList', $this->getAttribute('site'));
        $Control->setAttribute('imageFit', $this->getAttribute('image'));

        $result = $Control->create();

        $this->addCSSFiles($Control->getCSSFiles());

        $options = [
            'body' => $result
        ];

        $Engine->assign($options);

        return $Engine->fetch(\dirname(__FILE__) . '/Timeline.html');
    }