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

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

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

delormejonathan/active-menu-bundle

最新稳定版本:v1.0.17

Composer 安装命令:

composer require delormejonathan/active-menu-bundle

包简介

A Symfony extension to get active class base on current bundle/controller/action

README 文档

README

Installation

composer require delormejonathan/active-menu-bundle
public function registerBundles()
{
    $bundles = array(
        new DelormeJonathan\ActiveMenuBundle\DelormeJonathanActiveMenuBundle(),
    );

Usage in your twig template

For example, if you have this action AppBundle\Controller\ElementsController::list, you can

Get the current bundle name

{{ bundle_name() }} # returns App

Get the current controller name

{{ controller_name() }} # returns Elements

Get the current action name

{{ action_name() }} # returns list

Controller filter

It works with both full and short paths

<!-- classname is the string returned if controller matchs (you can replace it by 'active' or 'current') -->
<li class="{{ 'AppBundle\Controller\ElementsController' | is_controller_active('classname') }}"></li>
<li class="{{ 'Elements' | is_controller_active('classname') }}"></li>

Action filter

<!-- classname is the string returned if controller matchs (you can replace it by 'active' or 'current') -->
<li class="{{ 'list' | is_action_active('classname') }}"></li>

Combined controller/action filter

<!-- classname is the string returned if controller matchs (you can replace it by 'active' or 'current') -->
<li class="{{ [ 'Elements::list' ] | is_action_active('classname') }}"></li>
<li class="{{ [ 'AppBundle\Controller\Elements::list' ] | is_action_active('classname') }}"></li>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-25