the-cocktail/sulu-megamenu-bundle
Composer 安装命令:
composer require the-cocktail/sulu-megamenu-bundle
包简介
Bundle for managing Mega Menus in the Sulu content management system
README 文档
README
Create complex tree menus in Sulu with sections, image items, external url, custom url, etc..
Installation
Add SuluMegamenuBundle in your composer.json:
composer require the-cocktail/sulu-megamenu-bundle
Register the bundle
Register the bundle in your config/bundles.php:
<?php // config/bundles.php return [ // ... TheCocktail\Bundle\MegaMenuBundle\SuluMegamenuBundle::class => ['all' => true], // ... ];
Update your data with:
bin/console doctrine:schema:update --force
Or execute the following SQL: (recomended: use doctrine migrations to generate diff migration)
CREATE TABLE mm_menuitem (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, parent_id INT DEFAULT NULL, resource_key VARCHAR(255) NOT NULL, webspace VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, locale VARCHAR(255) NOT NULL, uuid VARCHAR(255) DEFAULT NULL, link VARCHAR(255) DEFAULT NULL, position INT NOT NULL, INDEX IDX_D6C6460BEA9FDD75 (media_id), INDEX IDX_D6C6460B727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB; ALTER TABLE mm_menuitem ADD CONSTRAINT FK_D6C6460BEA9FDD75 FOREIGN KEY (media_id) REFERENCES me_media (id); ALTER TABLE mm_menuitem ADD CONSTRAINT FK_D6C6460B727ACA70 FOREIGN KEY (parent_id) REFERENCES mm_menuitem (id)
Configure the routing
# config/routes/sulu_admin.yaml sulu_megamenu_api: resource: "@SuluMegamenuBundle/Resources/config/routing_api.yaml" type: rest prefix: /admin/api
Configure SuluMegamenu
Add config/packages/sulu_megamenu.yaml with your desired menus:
sulu_megamenu: menus: header_top: title: 'Header Top' header: title: 'Header' footer: title: 'Footer' footer_bottom: title: 'Footer Bottom'
Permissions
Make sure you've set the correct permissions in the Sulu backend for this bundle!
Settings > User Roles
Twig Functions
sulu_megamenu_render
This function will render the default template
{{ sulu_megamenu_render('header') }}
Custom template as argument
{{ sulu_megamenu_render('header', 'menu/header.html.twig') }}
Additional parameters
{{ sulu_megamenu_render('header', 'menu/header.html.twig', request.webspaceKey, app.request.locale) }}
sulu_megamenu_get
Get items to reuse in diferent context
{% set items = sulu_megamenu_get('header') %}
{% include 'menu/desktop.html.twig' %}
{% include 'menu/mobile.html.twig' %}
Additional parameters:
{{ sulu_megamenu_get('header', request.webspaceKey, app.request.locale) }}
Enjoy it!
the-cocktail/sulu-megamenu-bundle 适用场景与选型建议
the-cocktail/sulu-megamenu-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.91k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2020 年 11 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 the-cocktail/sulu-megamenu-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 the-cocktail/sulu-megamenu-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-09