1<?php namespace ILIAS\News\Provider; 2 3use ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider; 4use ILIAS\MainMenu\Provider\StandardTopItemsProvider; 5 6/** 7 * Class NewsMainBarProvider 8 * 9 * @author Fabian Schmid <fs@studer-raimann.ch> 10 */ 11class NewsMainBarProvider extends AbstractStaticMainMenuProvider 12{ 13 14 /** 15 * @inheritDoc 16 */ 17 public function getStaticTopItems() : array 18 { 19 return []; 20 } 21 22 23 /** 24 * @inheritDoc 25 */ 26 public function getStaticSubItems() : array 27 { 28 $dic = $this->dic; 29 30 $title = $this->dic->language()->txt("mm_news"); 31 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("nwss", $title)->withIsOutlined(true); 32 33 return [ 34 $this->mainmenu->link($this->if->identifier('mm_pd_news')) 35 ->withTitle($title) 36 ->withAction("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToNews") 37 ->withParent(StandardTopItemsProvider::getInstance()->getCommunicationIdentification()) 38 ->withPosition(30) 39 ->withSymbol($icon) 40 ->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt('component_not_active')}")) 41 ->withAvailableCallable( 42 function () use ($dic) { 43 return ($dic->settings()->get("block_activated_news")); 44 } 45 ), 46 ]; 47 } 48} 49