*/ class ModuleArticle extends \Contao\ModuleArticle { /** * Inject some article layout stuff * * @param boolean $blnNoMarkup * * @return string */ public function generate($blnNoMarkup=false) { if ($this->es_type) { $ArticleLayout = ArticleLayoutsModel::findByPk($this->es_type); if ($ArticleLayout !== null) { // Select background image and add inline styles if ($ArticleLayout->showBackgroundImage) { $Image = \FilesModel::findByPk($this->es_backgroundSRC); if (!is_null($Image)) { $arrData = array ( 'singleSRC' => $Image->path, 'size' => $ArticleLayout->bgImageSize ); $objClass = new \stdClass(); $this->addImageToTemplate($objClass, $arrData, \Config::get('maxImageWidth')); if (trim($ArticleLayout->bgStyle)) { $this->arrStyle[] = str_ireplace('##bg_image##',$objClass->src,$ArticleLayout->bgStyle); } else { $this->arrStyle[] = "background: url('".$objClass->src."');"; } } } // Set article layout related variables to be used in article template $this->useHelper = $ArticleLayout->useHelper; $this->maxWidth = $ArticleLayout->maxWidth; $this->center = $ArticleLayout->center; $this->articleLayoutClass = $ArticleLayout->alias; } } return parent::generate($blnNoMarkup); } }