/** * Compile accordion group. * * @return void */ protected function compile() { if ($this->wrapper->isTypeOf(Wrapper\Helper::TYPE_START)) { Bootstrap::setConfigVar('runtime.accordion-group', 'accordion-group-' . $this->id); $this->Template->groupId = Bootstrap::getConfigVar('runtime.accordion-group'); } else { Bootstrap::setConfigVar('runtime.accordion-group', null); } }
/** * @param \Template $template */ public static function setAccordionState(\Template $template) { $group = static::getGroup(); if ($group) { if (Bootstrap::getConfigVar('runtime.accordion-group-first')) { $template->accordion = 'collapse in'; Bootstrap::setConfigVar('runtime.accordion-group-first', false); } else { $template->accordion = 'collapse'; } } else { $template->accordion = $template->accordion == 'accordion' ? 'collapse' : $template->accordion; } }
/** * @param GenerateEvent $event */ public function createModalFooter(GenerateEvent $event) { $widget = $event->getWidget(); $element = $event->getContainer()->getElement(); if ($this->isPartOfModalFooter($widget)) { $buttons = (array) Bootstrap::getConfigVar('runtime.modal-footer'); // create copy for footer /** @var Element $element */ $copy = clone $element; $copy->setAttribute('onclick', sprintf('$(\'#ctrl_%s\').click();', $widget->id)); $copy->setId('md_' . $element->getId()); $copy->addClass('btn'); $buttons[] = $copy; Bootstrap::setConfigVar('runtime.modal-footer', $buttons); } }
/** * @param $module * @param \ModuleModel $model * @return array */ protected function generateModule($module, \ModuleModel $model) { $class = $module['cssClass']; if ($module['floating']) { if ($class != '') { $class .= ' '; } $class .= 'navbar-' . $module['floating']; } // TODO: Do we have to make this list configurable? if (in_array($model->type, array('navigation', 'customnav', 'quicklink'))) { $navClass = 'nav navbar-nav'; if ($module['floating']) { $navClass .= ' navbar-' . $module['floating']; } Bootstrap::setConfigVar('runtime.nav-class', $navClass); } $rendered = $this->getFrontendModule($model); Bootstrap::setConfigVar('runtime.nav-class', ''); return array('type' => 'module', 'module' => $rendered, 'id' => $module['module'], 'class' => $class); }
/** * 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; }
/** * Initialize the helper. * * @return void */ private function initialize() { $level = substr($this->template->level, 6); $attributes = $this->listAttributes; $attributes->addClass($this->template->level); if ($level === '1') { $class = Bootstrap::getConfigVar('runtime.nav-class'); if ($class) { $attributes->addClass('nav'); $attributes->addClass($class); Bootstrap::setConfigVar('runtime.nav-class', ''); } } elseif ($level === '2') { $attributes->addClass('dropdown-menu'); } if ($level > 1 && $this->template->items) { // get the current page id $pageId = $this->template->items[0]['pid']; $page = \PageModel::findByPk($pageId); if ($this->disableChildrenList($level, $page)) { $this->setChildrenList(false); } } }
/** * Generate the modal. * * @return string * * @SuppressWarnings(PHPMD.ExitExpression) */ public function generate() { if (TL_MODE == 'BE') { $template = new \FrontendTemplate('be_wildcard'); $template->wildcard = '### modal window ###'; return $template->parse(); } if (\Input::get('bootstrap_modal') == $this->id) { if ($this->bootstrap_modalAjax) { $this->isAjax = true; } } $content = parent::generate(); $content = $this->replaceInsertTags($content); // add content to TL_BODY if ($this->isAjax) { echo $content; exit; } Bootstrap::setConfigVar('runtime.modals.' . $this->id, $content); return ''; }
/** * Initialize */ private function initialize() { $level = substr($this->template->level, 6); $attributes = $this->listAttributes; $attributes->addClass($this->template->level); switch ($level) { case '1': $class = Bootstrap::getConfigVar('runtime.nav-class'); if ($class) { $attributes->addClass('nav'); $attributes->addClass($class); Bootstrap::setConfigVar('runtime.nav-class', ''); } break; case '2': $attributes->addClass('dropdown-menu'); break; default: $attributes->addClass('dropdown-menu')->addClass('collapse'); break; } if ($level > 1) { $disableChildrenList = !($this->template->items && ($level != 1 && $level % 2 == 1)); $this->setChildrenList($disableChildrenList); } }