/** * Set runtime navigation class. * * This method is triggered by the isVisibleElement Hook. This means that when being logged in as backend user * using the frontend preview it does not work! * * @param \Model $element Current element model. * @param bool $isVisible Visible state. * * @return bool */ public static function setRuntimeNavClass(\Model $element, $isVisible) { // load module if it is a module include element if ($element instanceof \ContentModel && $element->type == 'module') { $element = \ModuleModel::findByPK($element->module); } if (!$element instanceof \ModuleModel) { return $isVisible; } // do not limit for navigation module. so every module can access it // bootstrap_inNavbar is dynamically set of navbar module if ($element->bootstrap_inNavbar) { $class = 'nav navbar-nav'; if ($element->bootstrap_navbarFloating == 'right') { $class .= 'navbar-right'; } } elseif ($element->bootstrap_navClass) { $class = $element->bootstrap_navClass; } else { $class = 'nav nav-default'; } Bootstrap::setConfigVar('runtime.nav-class', $class); return $isVisible; }
protected function renderModule($objChild) { $objModule = \ModuleModel::findByPK($objChild->module); if ($objModule === null) { return ''; } if (!\Controller::isVisibleElement($objModule)) { return ''; } $strClass = \Module::findClass($objModule->type); if (!class_exists($strClass)) { $this->log('Module class "' . $GLOBALS['FE_MOD'][$objModule->type] . '" (module "' . $objModule->type . '") does not exist', 'ModuleBlock renderModule()', TL_ERROR); return ''; } $objModule->typePrefix = 'mod_'; if (!$objChild->addWrapper) { $objModule = $this->overrideCommonProps($objModule, $objChild); } $objModule = new $strClass($objModule); return $objModule->generate(); }
/** * Get columns for a a specific module. * * @param \DataContainer $dataContainer The data container driver. * * @return array * * @SuppressWarnings(PHPMD.Superglobals) */ public function getColumnsForModule($dataContainer) { if ($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') { $subcolumns = new \tl_module_sc(); return $subcolumns->getColumns($dataContainer); } $model = \ModuleModel::findByPK($dataContainer->currentRecord); $cols = array(); $translate = array('first', 'second', 'third', 'fourth', 'fith'); for ($i = 0; $i < $model->sc_type; $i++) { if (!array_key_exists($i, $translate)) { break; } $key = $translate[$i]; $cols[$key] = $GLOBALS['TL_LANG']['MSC']['sc_' . $key]; } return $cols; }