Event allowing to customize build-in menus.
Storefront menus are based on the and are easily extensible via event subscribers. You can listen to the following events:
-
ibexa.storefront.breadcrumbs.configure.tree_root
-
ibexa.storefront.breadcrumbs.configure.taxonomy_entry
-
ibexa.storefront.breadcrumbs.configure.product
-
ibexa.storefront.breadcrumbs.configure.user_setting
-
ibexa.storefront.breadcrumbs.configure.user_settings_group
-
ibexa.storefront.currency_menu.configure
-
ibexa.storefront.taxonomy_menu.configure
-
ibexa.storefront.user_menu.configure
-
ibexa.storefront.language_menu.configure
-
ibexa.storefront.region_menu.configure
The example belows shows how to append link to "All entries" to taxonomy menu:
namespace App\EventSubscriber;
use Ibexa\Contracts\Storefront\Menu\Event\ConfigureMenuEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
final readonly class TaxonomyMenuSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
'ibexa.storefront.taxonomy_menu.configure' => 'onMenuConfigure',
];
}
public function onMenuConfigure(ConfigureMenuEvent $event): void
{
$menu = $event->getMenu();
$menu->addChild(
'all_categories',
[
'label' => 'All categories',
// ... other options
],
);
}
}
Methods¶
__construct() ¶
ConfigureMenuEvent.php
:
72
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$menu | ItemInterface | - | - |
$options | array<string, mixed> | [] | - |
getMenu() ¶
ConfigureMenuEvent.php
:
78
|
|
Return values
ItemInterface
getOptions() ¶
ConfigureMenuEvent.php
:
86
|
|
Return values
array<string, mixed>
isPropagationStopped() ¶
Event.php
:
38
|
|
Return values
bool
stopPropagation() ¶
Event.php
:
50
Stops the propagation of the event to further event listeners.
|
|
If multiple event listeners are connected to the same event, no further event listener will be triggered once any trigger calls stopPropagation().