1<?php 2 3/** 4 * Class ilMMEntryRendererGUI 5 * 6 * @author Fabian Schmid <fs@studer-raimann.ch> 7 */ 8class ilMMEntryRendererGUI 9{ 10 11 /** 12 * @return string 13 * @throws Throwable 14 * @throws ilTemplateException 15 */ 16 public function getHTML() : string 17 { 18 $html = ""; 19 20 // Plugin-Slot 21 $uip = new ilUIHookProcessor( 22 "Services/MainMenu", 23 "main_menu_list_entries", 24 array("main_menu_gui" => $this) 25 ); 26 27 if (!$uip->replaced()) { 28 $html = $this->render(); 29 } 30 31 $html = $uip->getHTML($html); 32 33 return $html; 34 } 35 36 37 /** 38 * @return string 39 * @throws Throwable 40 * @throws ilTemplateException 41 */ 42 protected function render() : string 43 { 44 global $DIC; 45 46 $top_items = (new ilMMItemRepository())->getStackedTopItemsForPresentation(); 47 $tpl = new ilTemplate("tpl.main_menu_legacy.html", true, true, 'Services/MainMenu'); 48 /** 49 * @var $top_item \ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem|\ILIAS\GlobalScreen\Scope\MainMenu\Factory\isTopItem 50 */ 51 $components = []; 52 53 foreach ($top_items as $top_item) { 54 $components[] = $top_item->getTypeInformation()->getRenderer()->getComponentForItem($top_item); 55 } 56 57 $tpl->setVariable("ENTRIES", $DIC->ui()->renderer()->render($components)); 58 59 return $tpl->get(); 60 } 61} 62