vendor/codefog/contao-haste/library/Haste/Frontend/AbstractFrontendModule.php line 52

Open in your IDE?
  1. <?php
  2. /**
  3.  * Haste utilities for Contao Open Source CMS
  4.  *
  5.  * Copyright (C) 2012-2016 Codefog & terminal42 gmbh
  6.  *
  7.  * @package    Haste
  8.  * @link       http://github.com/codefog/contao-haste/
  9.  * @license    http://opensource.org/licenses/lgpl-3.0.html LGPL
  10.  */
  11. namespace Haste\Frontend;
  12. use Contao\BackendTemplate;
  13. use Contao\Module;
  14. abstract class AbstractFrontendModule extends Module
  15. {
  16.     /**
  17.      * @var bool
  18.      */
  19.     private $wildcard true;
  20.     public function __construct($objModule$strColumn 'main')
  21.     {
  22.         parent::__construct($objModule$strColumn);
  23.         foreach ($this->getSerializedProperties() as $k => $name) {
  24.             $force true;
  25.             if (is_bool($name)) {
  26.                 $force $name;
  27.                 $name  $k;
  28.             }
  29.             if (array_key_exists($name$this->arrData)) {
  30.                 $this->arrData[$name] = deserialize($this->arrData[$name], $force);
  31.             }
  32.         }
  33.     }
  34.     /**
  35.      * @inheritdoc
  36.      */
  37.     public function generate()
  38.     {
  39.         if ('BE' === TL_MODE && $this->showWildcard()) {
  40.             return $this->generateWildcard();
  41.         }
  42.         return parent::generate();
  43.     }
  44.     /**
  45.      * Generate wildcard template for backend output.
  46.      *
  47.      * @return string
  48.      */
  49.     protected function generateWildcard()
  50.     {
  51.         $objTemplate = new BackendTemplate('be_wildcard');
  52.         $objTemplate->wildcard '### ' mb_strtoupper($GLOBALS['TL_LANG']['FMD'][$this->type][0] ?? '') . ' ###';
  53.         $objTemplate->title    $this->headline;
  54.         $objTemplate->id       $this->id;
  55.         $objTemplate->link     $this->name;
  56.         $objTemplate->href     'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' $this->id;
  57.         return $objTemplate->parse();
  58.     }
  59.     /**
  60.      * Returns whether the wildcard should be shown in the backend.
  61.      *
  62.      * @return bool
  63.      */
  64.     protected function showWildcard()
  65.     {
  66.         return $this->wildcard;
  67.     }
  68.     /**
  69.      * Sets whether the wildcard should be shown in the backend.
  70.      *
  71.      * @param bool $wildcard
  72.      */
  73.     protected function setWildcard($wildcard)
  74.     {
  75.         $this->wildcard $wildcard;
  76.     }
  77.     /**
  78.      * An array of serialized properties that will be deserialized on construction.
  79.      * If you don't want to control the $forceArray option of deserialize(),
  80.      * set the property name as key and a boolean value in the array.
  81.      *
  82.      * @return array
  83.      */
  84.     protected function getSerializedProperties()
  85.     {
  86.         return [];
  87.     }
  88. }