/** * Parse the template * @return string */ public function generate() { if (TL_MODE == 'BE') { // create new backend template $objTemplate = new \BackendTemplate('be_include'); // get all include elements $objElements = \ContentModel::findBy('module', $this->module, array('order' => 'id')); // prepare include breadcrumbs $includes = array(); // go throuch each include element while ($objElements->next()) { // get the parent article $objArticle = \ArticleModel::findByPk($objElements->pid); if ($objArticle === null) { continue; } // get the parent pages $objPages = \PageModel::findParentsById($objArticle->pid); if ($objPages === null) { continue; } // get the page titles $arrPageTitles = array_reverse($objPages->fetchEach('title')); // css classes for list $classes = array(); if ($objElements->id == $this->id) { $classes[] = 'self'; } if ($objElements->invisible) { $classes[] = 'hidden'; } // create breadcrumb $includes[] = array('crumbs' => implode(' » ', $arrPageTitles), 'article' => array('title' => $objArticle->title, 'link' => 'contao/main.php?do=article&table=tl_content&id=' . $objArticle->id . '&rt=' . REQUEST_TOKEN), 'class' => implode(' ', $classes)); } // set include breadcrumbs if (count($includes) > 1) { $objTemplate->includes = $includes; } // add CSS $GLOBALS['TL_CSS'][] = \IncludeInfoHelper::BACKEND_CSS; // return info + content return $objTemplate->parse() . parent::generate(); } // return content only return parent::generate(); }