Copied!

ConfigureMenuEvent

ConfigureMenuEvent.php : 62
Extends Event

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

public__construct()

ConfigureMenuEvent.php : 72
public __construct(ItemInterface $menu[, array<string, mixed> $options = [] ])

Parameters

Name Type Default value Description
$menu ItemInterface - -
$options array<string, mixed> [] -

publicgetMenu()

ConfigureMenuEvent.php : 78
public getMenu() : ItemInterface

Return values

ItemInterface

publicgetOptions()

ConfigureMenuEvent.php : 86
public getOptions() : array<string, mixed>

Return values

array<string, mixed>

publicisPropagationStopped()

Event.php : 38
public isPropagationStopped() : bool

Return values

bool

publicstopPropagation()

Event.php : 50

Stops the propagation of the event to further event listeners.

public stopPropagation() : void

If multiple event listeners are connected to the same event, no further event listener will be triggered once any trigger calls stopPropagation().