Skip to content

Instantly share code, notes, and snippets.

@Osukaru
Created October 2, 2011 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Osukaru/1257327 to your computer and use it in GitHub Desktop.
Save Osukaru/1257327 to your computer and use it in GitHub Desktop.
Extender MenuBundle
<?php
namespace SFM\WebsiteBundle\Menu;
use Knp\Bundle\MenuBundle\Menu;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Router;
class MainMenu extends Menu
{
public function addChild($child, $uri = null, $attributes = array(), $class = null)
{
$child = parent::addChild($child, $uri, $attributes, $class);
if ($child->getIsCurrent()) {
return $child->setLinkAttribute('class', 'active');
}
return $child;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment