Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix code style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolineus committed Dec 9, 2014
1 parent 8d0b03c commit df33bac
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private function initializeStartElement()
$cssId = $i . '-' . $cssId;
}

$ids[] = $cssId;
$ids[] = $cssId;
$tabs[$i]['id'] = $cssId;

if ($t['type'] != 'dropdown' && !$tab) {
Expand Down Expand Up @@ -150,7 +150,7 @@ private function initializeSeparator()
$cssId = $i . '-' . $cssId;
}

$ids[] = $cssId;
$ids[] = $cssId;
$tabs[$i]['id'] = $cssId;

if ($t['type'] != 'dropdown') {
Expand Down
4 changes: 3 additions & 1 deletion src/Netzmacht/Bootstrap/Components/Modal/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down
42 changes: 24 additions & 18 deletions src/Netzmacht/Bootstrap/Components/Navigation/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,33 +173,39 @@ 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) {
// get the current page id
$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');
}
}

0 comments on commit df33bac

Please sign in to comment.