/**
  * Return if there are no files
  * @return string
  */
 public function generate()
 {
     // show gallery instead of slickcarousel in backend mode
     if (TL_MODE == 'BE') {
         return parent::generate();
     }
     parent::generate();
     $objConfig = SlickConfigModel::findByPk($this->slickConfig);
     if ($objConfig === null) {
         return;
     }
     // Map content fields to slick fields
     $this->arrData['slickMultiSRC'] = $this->arrData['multiSRC'];
     $this->arrData['slickOrderSRC'] = $this->arrData['orderSRC'];
     $this->arrData['slickSortBy'] = $this->arrData['sortBy'];
     $this->arrData['slickUseHomeDir'] = $this->arrData['useHomeDir'];
     $this->arrData['slickSize'] = $this->arrData['size'];
     $this->arrData['slickFullsize'] = $this->arrData['fullsize'];
     $this->arrData['slickNumberOfItems'] = $this->arrData['numberOfItems'];
     $this->arrData['slickCustomTpl'] = $this->arrData['customTpl'];
     $objGallery = new Slick(Slick::createSettings($this->arrData, $objConfig));
     $this->Template->class .= ' ' . SlickConfig::getCssClassFromModel($objConfig) . ' slick';
     $this->Template->images = $objGallery->getImages();
     return $this->Template->parse();
 }
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $this->strTemplate = 'be_wildcard';
         $this->Template = new \BackendTemplate($this->strTemplate);
         $this->Template->title = $this->headline;
     }
     parent::generate();
     $objConfig = SlickConfigModel::findByPk($this->slickConfig);
     if ($objConfig === null) {
         return;
     }
     $this->Template->class .= ' ' . SlickConfig::getCssClassFromModel($objConfig) . ' slick ' . SlickConfig::getCssClassForContent($this->id);
     $this->Template->syncid = SlickConfig::getCssClassForContent($this->id);
     return $this->Template->parse();
 }
 public function parseArticlesHook(&$objTemplate, $arrArticle, $objModule)
 {
     if (!$arrArticle['addGallery']) {
         return;
     }
     $objArchive = \NewsArchiveModel::findByPk($arrArticle['pid']);
     if ($objArchive === null) {
         return;
     }
     $objConfig = SlickConfigModel::findByPk($objArchive->slickConfig);
     if ($objConfig === null) {
         return;
     }
     // set size from module
     $arrArticle['slickSize'] = $objModule->imgSize;
     $objGallery = new Slick(Slick::createSettings($arrArticle, $objConfig));
     $objTemplate->gallery = $objGallery->parse();
 }
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newslist'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     parent::generate();
     $objConfig = SlickConfigModel::findByPk($this->slickConfig);
     if ($objConfig !== null) {
         $this->Template->class .= ' ' . SlickConfig::getCssClassFromModel($objConfig) . ' slick';
     }
     return $this->Template->parse();
 }
 public static function createConfig($objConfig)
 {
     \Controller::loadDataContainer('tl_slick_spread');
     $arrConfig = array();
     $arrObjects = array();
     foreach ($objConfig->row() as $key => $value) {
         if (strstr($key, 'slick_') === false) {
             continue;
         }
         if (!isset($GLOBALS['TL_DCA']['tl_slick_spread']['fields'][$key])) {
             continue;
         }
         $arrData = $GLOBALS['TL_DCA']['tl_slick_spread']['fields'][$key];
         $slickKey = substr($key, 6);
         // trim slick_ prefix
         if ($arrData['eval']['rgxp'] == 'digit') {
             $value = intval($value);
         }
         if ($arrData['inputType'] == 'checkbox' && !$arrData['eval']['multiple']) {
             $value = (bool) filter_var($value, FILTER_VALIDATE_BOOLEAN);
         }
         if ($arrData['eval']['multiple'] || $arrData['inputType'] == 'multiColumnWizard') {
             $value = deserialize($value, true);
         }
         if ($arrData['eval']['isJsObject']) {
             $arrObjects[] = $slickKey;
         }
         // check type as well, otherwise
         if ($value === '') {
             continue;
         }
         if ($key == 'slick_responsive') {
             $arrResponsive = array();
             foreach ($value as $config) {
                 if (empty($config['slick_settings'])) {
                     continue;
                 }
                 $objResponsiveConfig = SlickConfigModel::findByPk($config['slick_settings']);
                 if ($objResponsiveConfig === null) {
                     continue;
                 }
                 $config['breakpoint'] = $config['slick_breakpoint'];
                 unset($config['slick_breakpoint']);
                 $settings = static::createConfig($objResponsiveConfig);
                 if ($settings['config']['unslick']) {
                     $config['settings'] = 'unslick';
                 } else {
                     $config['settings'] = $settings['config'];
                 }
                 unset($config['slick_settings']);
                 $arrResponsive[] = $config;
             }
             if (empty($arrResponsive)) {
                 $value = false;
             } else {
                 $value = $arrResponsive;
             }
         }
         if ($key == 'slick_asNavFor') {
             $value = null;
             // should be null by default
             $objTargetConfig = SlickConfigModel::findByPk($value);
             if ($objTargetConfig !== null) {
                 $value = static::getSlickContainerSelectorFromModel($objTargetConfig);
             }
         }
         if ($key) {
             $arrConfig[$slickKey] = $value;
         }
     }
     // remove responsive settings, otherwise center wont work
     if (empty($arrResponsive)) {
         unset($arrConfig['responsive']);
     }
     $arrReturn = array('config' => $arrConfig, 'objects' => $arrObjects);
     return $arrReturn;
 }