/** * Render navigations elements that renderNavigation hasn't dealt with * * @param $buttons array * @param $customItems array */ private function renderCustomNavigation(&$buttons, &$customItems) { /* TODO: check for unintended consequences, there are probably more elegant ways to do this... */ $options = new ParserOptions(); $localParser = new Parser(); $localParser->Title($this->getSkin()->getTitle()); $localParser->Options($options); $localParser->clearState(); if (count($customItems) !== 0) { $newButtons = TweekiHooks::parseButtons(implode(chr(10), $customItems), $localParser, false); $buttons = array_merge($buttons, $newButtons); $customItems = array(); } }
/** * Build buttons, groups of buttons and dropdowns * * @param $input string * @param $args array tag arguments * @param $parser Parser current parser * @param $frame PPFrame current frame * @return string */ static function buildButtons($input, array $args, Parser $parser, PPFrame $frame) { $sizes = array('large' => 'btn-lg', 'lg' => 'btn-lg', 'small' => 'btn-sm', 'sm' => 'btn-sm', 'mini' => 'btn-xs', 'xs' => 'btn-xs'); $renderedButtons = ''; $buttongroups = preg_split('/\\n{2,}/', $input); // set standard classes for all buttons in the group if (!isset($args['class'])) { $args['class'][] = 'btn btn-default'; } else { $args['class'] = explode(' ', $args['class']); } if (isset($args['size'])) { if (isset($sizes[$args['size']])) { $args['class'][] = $sizes[$args['size']]; } } foreach ($buttongroups as $buttongroup) { $buttons = array(); $buttons = TweekiHooks::parseButtons($buttongroup, $parser, $frame); $renderedButtons .= TweekiHooks::renderButtons($buttons, $args); } // more than one buttongroup build a toolbar if (count($buttongroups) > 1) { $renderedButtons = '<div class="btn-toolbar">' . $renderedButtons . '</div>'; } return $renderedButtons; }