19 declare(strict_types=1);
39 private \ilGlobalTemplateInterface
$tpl;
49 private array $elements = []
53 $this->
lng = $DIC[
'lng'];
54 $this->
toolbar = $DIC[
'ilToolbar'];
55 $this->tpl = $DIC[
'tpl'];
57 $this->ui_factory = $DIC[
'ui.factory'];
58 $this->ui_renderer = $DIC[
'ui.renderer'];
60 $this->
lng->loadLanguageModule(
'wsp');
61 $this->
lng->loadLanguageModule(
'rep');
62 $this->
lng->loadLanguageModule(
'cntr');
70 if ($this->elements === []) {
73 $modal = $this->ui_factory->modal()->roundtrip(
74 $this->
lng->txt(
'cntr_add_new_item'),
75 $this->ui_factory->menu()->drilldown(
76 $this->
lng->txt(
'object_list'),
82 $this->ui_factory->button()->primary(
83 $this->
lng->txt(
'cntr_add_new_item'),
84 $modal->getShowSignal()
87 $this->tpl->setVariable(
88 'IL_OBJECT_ADD_NEW_ITEM_MODAL',
89 $this->ui_renderer->render($modal)
100 foreach ($elements as $element) {
102 $sub_menu[] = $this->ui_factory->menu()->sub(
103 $element->getLabel(),
107 if ($element->getType() === AddNewItemElementTypes::Object) {
108 $sub_menu[] = $this->ui_factory->link()->bulky(
110 $element->getLabel(),
111 $element->getCreationUri()
buildAddNewItemsMenu(array $elements)
ilGlobalTemplateInterface $tpl
ilObjectDefinition $obj_definition
Render add new item selector.
render()
Add new item selection to current page incl.
__construct(private array $elements=[])