![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Menu/ |
<?php namespace Mautic\CoreBundle\Menu; use Knp\Menu\ItemInterface; use Knp\Menu\Matcher\MatcherInterface; use Knp\Menu\Renderer\RendererInterface; use Twig\Environment; class MenuRenderer implements RendererInterface { private array $defaultOptions; public function __construct( private MatcherInterface $matcher, private Environment $twig, array $defaultOptions = [] ) { $this->defaultOptions = array_merge( [ 'depth' => null, 'matchingDepth' => null, 'currentAsLink' => true, 'currentClass' => 'active', 'ancestorClass' => 'open', 'firstClass' => 'first', 'lastClass' => 'last', 'itemAttributes' => [], 'template' => '@MauticCore/Menu/main.html.twig', 'compressed' => false, 'allow_safe_labels' => false, 'clear_matcher' => true, ], $defaultOptions ); } /** * Renders menu. */ public function render(ItemInterface $item, array $options = []): string { $options = array_merge($this->defaultOptions, $options); if ($options['clear_matcher']) { $this->matcher->clear(); } // render html $html = $this->twig->render($options['template'], [ 'item' => $item, 'options' => $options, 'matcher' => $this->matcher, ]); return $html; } }