Download the PHP package monsieurbiz/sylius-menu-plugin without Composer
On this page you can find all versions of the php package monsieurbiz/sylius-menu-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download monsieurbiz/sylius-menu-plugin
More information about monsieurbiz/sylius-menu-plugin
Files in monsieurbiz/sylius-menu-plugin
Package sylius-menu-plugin
Short Description This plugins allows you to manage menus.
License MIT
Informations about the package sylius-menu-plugin
Sylius Menu Plugin
This plugins allows you to manage your menus.
Compatibility
Sylius Version | PHP Version |
---|---|
2.0 | 8.2 - 8.3 |
âšī¸ For Sylius 1.x, see our 1.x branch and all 1.x releases.
Installation
If you want to use our recipes, you can configure your composer.json by running:
Change your config/bundles.php
file to add the line for the plugin:
Then create the config file in config/packages/monsieurbiz_sylius_menu_plugin.yaml
:
Finally import the routes in config/routes/monsieurbiz_sylius_menu_plugin.yaml
:
Then run it:
Customize your menu
If you want to customize your menu, like adding an image, do so by overriding the MenuItem entity (more info about overriding entities in the Sylius documentation).
Add URL Provider
The URLs selector allows you to select a URL from a list of URLs. It provides URLs for:
- Taxons
- Products
You can add your own custom Provider by creating a class which implements the MonsieurBiz\SyliusMenuPlugin\Provider\UrlProviderInterface
interface.
Menu example
Admin form index
Menu front view
The front view is exactly the same as the default one.
Customize front view
Simple example
A menu can look very differently depending on where it should be displayed so most of the time you will need to create your own template to display it.
A good starting point is to create a monsieur_biz:shared:menu
component associated with your display template. You can find examples in the configuration file twig_hooks.yaml of the plugin.
To get the first items of a menu, you can call the getMenuItems
method of the component:
Replace menu_code
with the code of the menu you want to display.
Then you can loop through the items and display them as you want.
Advanced example
If you wish to define a menu code by channel and/or locale, we recommend you use the plugin Settings.
In this case, create a menu template containing, for example :
And use it in a configuration file which must be loaded after the config/packages/monsieurbiz_sylius_menu_plugin.yaml
file:
Contributing
You can open an issue or a Pull Request if you want! đ
Thank you!