Commit 9441ca61 authored by Tobias Haider's avatar Tobias Haider
Browse files

allow for headers in dropdowns, fixes #152

parent f4f6c158
......@@ -327,7 +327,13 @@ class TweekiHooks {
if ( !isset( $buttons[$currentparentkey]['items'] ) ) {
$buttons[$currentparentkey]['items'] = array();
}
$buttons[$currentparentkey]['items'] = array_merge( $buttons[$currentparentkey]['items'], TweekiHooks::parseButtonLink( $cleanline, $parser, $frame ) );
// dropdown-headers (dropdown-lines that start with a colon)
if ( strpos( $cleanline, ':' ) === 0 ) {
$buttons[$currentparentkey]['items'][] = [ 'text' => ltrim( $cleanline, ':' ), 'header' => true ];
} else {
$buttons[$currentparentkey]['items'] = array_merge( $buttons[$currentparentkey]['items'], TweekiHooks::parseButtonLink( $cleanline, $parser, $frame ) );
}
}
}
return $buttons;
......@@ -366,7 +372,7 @@ class TweekiHooks {
return $semanticLinks;
}
else {
$text = 'broken';
$text = 'INVALID-TITLE/QUERY-BROKEN';
}
}
......@@ -670,6 +676,11 @@ class TweekiHooks {
$renderedMenu .= '<li class="divider" />';
}
// header
elseif ( isset( $entry['text'] ) && isset( $entry['header'] ) && $entry['header'] ) {
$renderedMenu .= '<li class="dropdown-header">' . $entry['text'] . '</li>';
}
// standard menu entry
else {
$entry['tabindex'] = '-1';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment