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

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 TeaserBox
  12.  *
  13.  * @author Mathias Arzberger <develop@pdir.de>
  14.  */
  15. class TeaserBox extends \ContentElement
  16. {
  17.     /**
  18.      * Template
  19.      * @var string
  20.      */
  21.     protected $strTemplate 'ce_mate_teaserbox';
  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 '### ' utf8_strtoupper($GLOBALS['TL_LANG']['CTE']['mateTeaserBox'][0]) . ' ###';
  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->mateTeaserBox_customTpl != "") {
  48.             $this->Template->setName($this->mateTeaserBox_customTpl);
  49.         }
  50.         $this->Template->page $this->mateTeaserBox_page;
  51.         $this->Template->pageText $this->mateTeaserBox_pageText;
  52.         $this->Template->subheadline $this->mateTeaserbox_subHeadline;
  53.         // add an image
  54.         if ($this->addImage && $this->singleSRC != '')
  55.         {
  56.             $this->Template->picture \FilesModel::findByUuid($this->singleSRC)->path;
  57.             $objModel \FilesModel::findByUuid($this->singleSRC);
  58.             if ($objModel !== null && is_file(\System::getContainer()->getParameter('kernel.project_dir') . '/' $objModel->path))
  59.             {
  60.                 $this->singleSRC $objModel->path;
  61.                 $this->addImageToTemplate($this->Template$this->arrDatanullnull$objModel);
  62.             }
  63.         }
  64.         // overwrite link target
  65.         $this->Template->target '';
  66.         $this->Template->rel '';
  67.         if ($this->target)
  68.         {
  69.             $this->Template->target ' target="_blank"';
  70.             $this->Template->rel ' rel="noreferrer noopener"';
  71.         }
  72.     }
  73. }