40 return new self(self::TYPE_SPLIT);
45 $this->menu_items[] = $menu_item;
50 $key = array_search($menu_item, $this->menu_items);
52 unset($this->menu_items[$key]);
58 return count($this->menu_items) > 0;
75 array_walk($menu_items,
static function ($item, $idx):
void {
78 "Cannot set menu items, element at index '%s' is not of type 'ilSplitButtonItem'",
107 $tpl =
new ilTemplate(
'tpl.split_button.html',
true,
true,
'components/ILIAS/UIComponent/SplitButton');
111 "Cannot render a split button without a default button" 119 $btn_classes[] =
'btn-primary';
121 $tpl->setVariable(
'BTN_CSS_CLASS', implode(
' ', $btn_classes));
125 $tpl->setCurrentBlock(
'separator');
126 $tpl->touchBlock(
'separator');
128 $tpl->setCurrentBlock(
'item');
129 $tpl->setVariable(
'CONTENT', $item->getContent());
131 $tpl->parseCurrentBlock();
133 $tpl->setCurrentBlock(
'items');
134 $tpl->parseCurrentBlock();
137 $tpl->setVariable(
'TXT_TOGGLE_DROPDOWN', $this->
lng->txt(
'toggle_dropdown'));
__construct(Container $dic, ilPlugin $plugin)