Total Complexity | 3 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class ItemExtension extends AbstractExtension |
||
19 | { |
||
20 | /** @var NavigationHelper */ |
||
21 | private $helper; |
||
22 | /** @var ItemContainerInterface */ |
||
23 | private $container; |
||
24 | /** @var MatcherInterface */ |
||
25 | private $matcher; |
||
26 | |||
27 | public function __construct( |
||
35 | } |
||
36 | |||
37 | public function renderItem( |
||
38 | Environment $environment, |
||
39 | string $name, |
||
40 | string $template = '@EverlutionNavigation/bootstrap_navigation_item.html.twig' |
||
41 | ): string { |
||
42 | $item = $this->container->get($name); |
||
43 | |||
44 | return $environment->render( |
||
45 | $template, |
||
46 | [ |
||
47 | 'item' => $item, |
||
48 | 'helper' => $this->helper, |
||
49 | 'is_active' => $this->matcher->isCurrent($item), |
||
50 | ] |
||
51 | ); |
||
52 | } |
||
53 | |||
54 | public function getFunctions() |
||
61 | ), |
||
62 | ]; |
||
65 |