diff --git a/src/Netzmacht/Bootstrap/Components/Contao/ContentElement/Tab.php b/src/Netzmacht/Bootstrap/Components/Contao/ContentElement/Tab.php index a8bfedc..f6289d3 100644 --- a/src/Netzmacht/Bootstrap/Components/Contao/ContentElement/Tab.php +++ b/src/Netzmacht/Bootstrap/Components/Contao/ContentElement/Tab.php @@ -108,7 +108,7 @@ private function initializeStartElement() $cssId = $i . '-' . $cssId; } - $ids[] = $cssId; + $ids[] = $cssId; $tabs[$i]['id'] = $cssId; if ($t['type'] != 'dropdown' && !$tab) { @@ -150,7 +150,7 @@ private function initializeSeparator() $cssId = $i . '-' . $cssId; } - $ids[] = $cssId; + $ids[] = $cssId; $tabs[$i]['id'] = $cssId; if ($t['type'] != 'dropdown') { diff --git a/src/Netzmacht/Bootstrap/Components/Modal/Subscriber.php b/src/Netzmacht/Bootstrap/Components/Modal/Subscriber.php index df9d680..ca96b5f 100644 --- a/src/Netzmacht/Bootstrap/Components/Modal/Subscriber.php +++ b/src/Netzmacht/Bootstrap/Components/Modal/Subscriber.php @@ -148,7 +148,7 @@ public function replaceModalButtonInsertTag(ReplaceInsertTagsEvent $event) $classes = array_filter(explode(' ', $event->getParam(1))); $classes = array_map( - function($class) { + function ($class) { return 'btn-' . $class; }, $classes @@ -378,6 +378,8 @@ private function replaceDeprecatedInsertTag(ReplaceInsertTagsEvent $event, $para * @param string $label Optional custom label. * * @return Standalone|null + * + * @SuppressWarnings(PHPMD.Superglobals) */ private function createLink($modelId, $label = null) { diff --git a/src/Netzmacht/Bootstrap/Components/Navigation/Helper.php b/src/Netzmacht/Bootstrap/Components/Navigation/Helper.php index 4f4ee38..875b07e 100644 --- a/src/Netzmacht/Bootstrap/Components/Navigation/Helper.php +++ b/src/Netzmacht/Bootstrap/Components/Navigation/Helper.php @@ -173,23 +173,16 @@ private function initialize() $attributes->addClass($this->template->level); - switch ($level) { - case '1': - $class = Bootstrap::getConfigVar('runtime.nav-class'); + if ($level === '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: + 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) { @@ -197,9 +190,22 @@ private function initialize() $pageId = $this->template->items[0]['pid']; $page = \PageModel::findByPk($pageId); - if ($level > 2 && $page && ($page->type == 'm17Folder' || $page->type == 'folder')) { - $this->setChildrenList(false); + if ($this->disableChildrenList($level, $page)) { + $this->setChildrenList(false); } } } + + /** + * Should children list be disabled. + * + * @param int $level Current level. + * @param \PageModel|null $page Parent page. + * + * @return bool + */ + private function disableChildrenList($level, $page) + { + return $level > 2 && $page && ($page->type == 'm17Folder' || $page->type == 'folder'); + } }