@@ -70,58 +70,7 @@ In this example, it removes a product roadmap entry from the menu and adds a hel
7070The tab is displayed in a production environment only.
7171
7272``` php
73- <?php
74-
75- declare(strict_types=1);
76-
77- namespace App\EventSubscriber;
78-
79- use Symfony\Component\EventDispatcher\EventSubscriberInterface;
80- use Symfony\Contracts\EventDispatcher\Event;
81-
82- final class HelpMenuSubscriber implements EventSubscriberInterface
83- {
84- public function __construct(
85- private readonly bool $kernelDebug
86- ) {}
87-
88- public static function getSubscribedEvents(): array
89- {
90- return [
91- 'ibexa_integrated_help.menu_configure.help_menu' => 'onHelpMenuConfigure',
92- ];
93- }
94-
95- public function onHelpMenuConfigure(Event $event): void
96- {
97- $menu = $event->getMenu();
98-
99- // Remove roadmap menu item
100- if ($menu->getChild('help__general')) {
101- $generalSection = $menu->getChild('help__general');
102- if ($generalSection->getChild('help__product_roadmap')) {
103- $generalSection->removeChild('help__product_roadmap');
104- }
105- }
106-
107- // Add videos tab, shown only in production
108- if ($this->kernelDebug === false) {
109- $resourcesSection = $menu->addChild('help__videos', [
110- 'label' => 'Product videos',
111- ]);
112-
113- $resourcesSection->addChild('help__webinar_v5', [
114- 'label' => 'Webinar: Introducing Ibexa DXP v5',
115- 'uri' => 'https://www.youtube.com/watch?v=qWaBHG2LRm8',
116- 'extras' => [
117- 'isHighlighted' => false,
118- 'icon' => 'https://doc.ibexa.co/en/5.0/templating/twig_function_reference/img/icons/video.svg.png',
119- 'description' => 'Discover new features and improvements brought by Ibexa DXP v5.',
120- ],
121- ]);
122- }
123- }
124- }
73+ [[= include_file('code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php') =]]
12574```
12675
12776!!! tip
0 commit comments