2017 © Pedro Peláez
 

symfony-bundle active-menu-bundle

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

image

delormejonathan/active-menu-bundle

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

  • Monday, June 4, 2018
  • by delormejonathan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,474 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 12 % Grown

The README.md

ActiveMenuBundle

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, (*1)

Get the current bundle name, (*2)

{{ bundle_name() }} # returns App

Get the current controller name, (*3)

{{ controller_name() }} # returns Elements

Get the current action name, (*4)

{{ action_name() }} # returns list

Controller filter, (*5)

It works with both full and short paths, (*6)

<!-- 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, (*7)

<!-- 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, (*8)

<!-- 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>

The Versions

04/06 2018

dev-master

9999999-dev https://github.com/delormejonathan/ActiveMenuBundle

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

  Sources   Download

MIT

The Requires

 

by Jonathan DELORME

symfony menu active delormejonathan

04/06 2018

v1.0.6

1.0.6.0 https://github.com/delormejonathan/ActiveMenuBundle

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

  Sources   Download

MIT

The Requires

 

by Jonathan DELORME

symfony menu active delormejonathan

26/04 2018

v1.0.5

1.0.5.0 https://github.com/delormejonathan/ActiveMenuBundle

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

  Sources   Download

MIT

The Requires

 

by Jonathan DELORME

symfony menu active delormejonathan

05/12 2016

v1.0.4

1.0.4.0 https://github.com/delormejonathan/ActiveMenuBundle

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

  Sources   Download

MIT

The Requires

 

by Jonathan DELORME

symfony menu active delormejonathan

25/11 2016

v1.0.3

1.0.3.0 https://github.com/delormejonathan/ActiveMenuBundle

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

  Sources   Download

MIT

The Requires

 

by Jonathan DELORME

symfony menu active delormejonathan

25/11 2016

v1.0.2

1.0.2.0 https://github.com/delormejonathan/ActiveMenuBundle

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

  Sources   Download

MIT

The Requires

 

by Jonathan DELORME

symfony menu active delormejonathan

25/11 2016

v1.0.1

1.0.1.0 https://github.com/delormejonathan/ActiveMenuBundle

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

  Sources   Download

MIT

The Requires

 

by Jonathan DELORME

symfony menu active delormejonathan

25/11 2016

v1.0.0

1.0.0.0 https://github.com/delormejonathan/ActiveMenuBundle

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

  Sources   Download

MIT

The Requires

 

by Jonathan DELORME

symfony menu active delormejonathan