1<?php namespace ILIAS\Tagging\Provider; 2 3use ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider; 4use ILIAS\MainMenu\Provider\StandardTopItemsProvider; 5use ILIAS\UI\Component\Symbol\Icon\Standard; 6 7/** 8 * Class TaggingMainBarProvider 9 * 10 * @author Fabian Schmid <fs@studer-raimann.ch> 11 */ 12class TaggingMainBarProvider extends AbstractStaticMainMenuProvider 13{ 14 15 /** 16 * @inheritDoc 17 */ 18 public function getStaticTopItems() : array 19 { 20 return []; 21 } 22 23 24 /** 25 * @inheritDoc 26 */ 27 public function getStaticSubItems() : array 28 { 29 $title = $this->dic->language()->txt("mm_tags"); 30 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::TAGS, $title)->withIsOutlined(true); 31 32 return [ 33 $this->mainmenu->complex($this->if->identifier('tags')) 34 ->withAvailableCallable(function () { 35 $tags_set = new \ilSetting("tags"); 36 return (bool) $tags_set->get("enable"); 37 }) 38 ->withTitle($title) 39 ->withSupportsAsynchronousLoading(true) 40 ->withSymbol($icon) 41 ->withContentWrapper(function () { 42 $tag_ui = new \ilTaggingSlateContentGUI(); 43 44 return $this->dic->ui()->factory()->legacy($tag_ui->render()); 45 }) 46 ->withParent(StandardTopItemsProvider::getInstance()->getPersonalWorkspaceIdentification()) 47 ->withPosition(20), 48 ]; 49 } 50} 51