symedit/menu-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

symedit/menu-bundle

最新稳定版本:v0.11

Composer 安装命令:

composer require symedit/menu-bundle

包简介

Symfony2 Bundle for managing menus with multiple sources

README 文档

README

The main point of this bundle is to allow multiple other bundles to construct a single menu. The way this is done is by adding tags to the DI container and then running the root node of the menu through each of the builders.

This bundle also adds a way to run menu extension after the menu has been built which can allow you to remove nodes before the menu is rendered.

Registering a Builder

<service id="symedit_blog.symedit.menu" class="%symedit_blog.symedit.menu.class%">
    <tag name="symedit_menu.builder" menu="symedit_admin" priority="16" />
</service>

menu is required on the tag. If there are multiple tags with the same menu name then they will be built according to priority (higher priority means the that builder will execute first, default is 0).

Extensions

Security Extension

You may add is_granted information to menu items and they will be removed if the user does not have these permissions:

$menu->addChild('Label', array(
    'extras' => array(
        'is_granted' => 'ROLE_ADMIN'
    ),
));

Remove Empty Dropdowns

You can use remove_leaf to remove any dropdowns with no children. We suggest having a main menu builder run first to create each of the dropdowns that your other bundles may use so they won't have to check if they exist first and create them if not. This solves the problem of no other builders using that dropdown:

$menu->addChild('Dropdown', array(
    'dropdown' => true, // From MopaBootstrapBundle
    'extras' => array(
        'remove_leaf' => true,
    ),
));

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-02-12