vendor/contao-themes-net/mate-theme-bundle/src/Resources/contao/elements/Mate/ParallaxElement.php line 71

Open in your IDE?
  1. <?php
  2. /**
  3.  * Contao Open Source CMS
  4.  *
  5.  * Copyright (c) 2005-2016 Leo Feyer
  6.  *
  7.  * @license LGPL-3.0+
  8.  */
  9. namespace ContaoThemesNet\MateThemeBundle\Mate;
  10. /**
  11.  * Class ParallaxElement
  12.  *
  13.  * @author Philipp Seibt <develop@pdir.de>
  14.  */
  15. class ParallaxElement extends \ContentElement
  16. {
  17.     /**
  18.      * Template
  19.      * @var string
  20.      */
  21.     protected $strTemplate 'ce_mate_parallax';
  22.     /**
  23.      * Display a wildcard in the back end
  24.      *
  25.      * @return string
  26.      */
  27.     public function generate()
  28.     {
  29.         if (TL_MODE == 'BE')
  30.         {
  31.             /** @var \BackendTemplate|object $objTemplate */
  32.             $objTemplate = new \BackendTemplate('be_wildcard_text');
  33.             $objTemplate->wildcard '### PARALLAX ELEMENT ###';
  34.             $objTemplate->title $this->headline;
  35.             $objTemplate->id $this->id;
  36.             $objTemplate->link $this->name;
  37.             $objTemplate->text \StringUtil::toHtml5($this->text);
  38.             return $objTemplate->parse();
  39.         }
  40.         return parent::generate();
  41.     }
  42.     /**
  43.      * Generate the module
  44.      */
  45.     protected function compile()
  46.     {
  47.         if($this->mateParallaxElement_customTpl != "") {
  48.             $this->Template->setName($this->mateParallaxElement_customTpl);
  49.         }
  50.         $this->Template->page $this->mateTeaserBox_page;
  51.         $this->Template->pageText $this->mateTeaserBox_pageText;
  52.         $this->Template->text $this->mateParallaxElement_text;
  53.         if ($this->addImage && $this->singleSRC != '')
  54.         {
  55.             $this->Template->picture \FilesModel::findByUuid($this->singleSRC)->path;
  56.             $objModel \FilesModel::findByUuid($this->singleSRC);
  57.             if ($objModel !== null && is_file(\System::getContainer()->getParameter('kernel.project_dir') . '/' $objModel->path))
  58.             {
  59.                 $this->singleSRC $objModel->path;
  60.                 $this->addImageToTemplate($this->Template$this->arrDatanullnull$objModel);
  61.             }
  62.         }
  63.         if($this->mateParallaxElement_height != "") {
  64.             $this->Template->height "min-height:".$this->mateParallaxElement_height."px;";
  65.         }
  66.     }
  67. }