monsieurbiz/sylius-menu-plugin
Composer 安装命令:
composer require monsieurbiz/sylius-menu-plugin
包简介
This plugins allows you to manage menus.
README 文档
README
Sylius Menu Plugin
This plugins allows you to manage your menus.
Compatibility
| Sylius Version | PHP Version |
|---|---|
| 2.0, 2.1 | 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:
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
composer require monsieurbiz/sylius-menu-plugin
Change your config/bundles.php file to add the line for the plugin:
<?php return [ //.. MonsieurBiz\SyliusMenuPlugin\MonsieurBizSyliusMenuPlugin::class => ['all' => true], ];
Then create the config file in config/packages/monsieurbiz_sylius_menu_plugin.yaml:
imports: - { resource: "@MonsieurBizSyliusMenuPlugin/Resources/config/config.yaml" } twig: form_themes: ['@MonsieurBizSyliusMenuPlugin/admin/browser/form/theme.html.twig']
Finally import the routes in config/routes/monsieurbiz_sylius_menu_plugin.yaml:
monsieurbiz_menu_admin: resource: "@MonsieurBizSyliusMenuPlugin/Resources/config/routes/admin.yaml" prefix: /%sylius_admin.path_name%
Then run it:
bin/console doctrine:migrations:migrate
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:
{% set items = this.getMenuItems('menu_code') %}
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 :
{% set configuration = hookableMetadata.configuration %}
{% set menu_code = setting(configuration.alias, configuration.path) %}
{# ... #}
And use it in a configuration file which must be loaded after the config/packages/monsieurbiz_sylius_menu_plugin.yaml file:
sylius_twig_hooks: hooks: 'sylius_shop.base.header.navbar': menu: component: 'monsieur_biz:shared:menu' props: template: 'shop/shared/menu.html.twig' configuration: alias: 'app.mysetting' path: 'main_menu_code' priority: 0
Contributing
You can open an issue or a Pull Request if you want! 😘
Thank you!
monsieurbiz/sylius-menu-plugin 适用场景与选型建议
monsieurbiz/sylius-menu-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 80.87k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2021 年 04 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sylius」 「sylius-plugin」 「monsieurbiz」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 monsieurbiz/sylius-menu-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 monsieurbiz/sylius-menu-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 monsieurbiz/sylius-menu-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Implementation of the Omnibus Directive for Sylius application.
A simple plugin to have sales reports in Sylius
Adds a simple message on top of your shop.
Bulk export of sylius resources
Sylius plugin that integrates Addwish
Setono example plugin for Sylius.
统计信息
- 总下载量: 80.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 19
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-24

