mirror of
				https://github.com/Icinga/icingaweb2.git
				synced 2025-11-04 05:05:01 +01:00 
			
		
		
		
	The menu was being rendered through recursive partials before. The overhead this fact implicates is not as efficient as standard recursion so there is now a special renderer for Icinga\Web\Menu utilizing the RecursiveIteratorIterator refs #6153
		
			
				
	
	
		
			44 lines
		
	
	
		
			949 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			949 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
// {{{ICINGA_LICENSE_HEADER}}}
 | 
						|
// {{{ICINGA_LICENSE_HEADER}}}
 | 
						|
 | 
						|
use Icinga\Web\MenuRenderer;
 | 
						|
use Icinga\Web\Controller\ActionController;
 | 
						|
use Icinga\Web\Hook;
 | 
						|
use Icinga\Web\Menu;
 | 
						|
use Icinga\Web\Url;
 | 
						|
 | 
						|
/**
 | 
						|
 * Create complex layout parts
 | 
						|
 */
 | 
						|
class LayoutController extends ActionController
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Render the menu
 | 
						|
     */
 | 
						|
    public function menuAction()
 | 
						|
    {
 | 
						|
        $this->view->menuRenderer = new MenuRenderer(Menu::fromConfig()->order(), Url::fromRequest()->getRelativeUrl());
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Render the top bar
 | 
						|
     */
 | 
						|
    public function topbarAction()
 | 
						|
    {
 | 
						|
        $topbarHtmlParts = array();
 | 
						|
 | 
						|
        /** @var Hook\Layout\TopBar $hook */
 | 
						|
        $hook = null;
 | 
						|
 | 
						|
        foreach (Hook::all('TopBar') as $hook) {
 | 
						|
            $topbarHtmlParts[] = $hook->getHtml($this->getRequest(), $this->view);
 | 
						|
        }
 | 
						|
 | 
						|
        $this->view->topbarHtmlParts = $topbarHtmlParts;
 | 
						|
 | 
						|
 | 
						|
        $this->renderScript('parts/topbar.phtml');
 | 
						|
    }
 | 
						|
}
 |