Skip to content

Commit

Permalink
[Menu] Fix broken extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Oct 31, 2015
1 parent 94aeaaa commit fb5a834
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/Clastic/MenuBundle/Twig/MenuExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
*/
class MenuExtension extends \Twig_Extension
{
/**
* @var \Twig_Environment
*/
private $environment;

/**
* @var MenuItemRepository
*/
Expand Down Expand Up @@ -54,19 +49,20 @@ public function getFunctions()
}

/**
* @param string $menuIdentifier
* @param int $depth
* @param \Twig_Environment $environment
* @param string $menuIdentifier
* @param int $depth
*
* @return string
*/
public function renderMenu($menuIdentifier, $depth = 1)
public function renderMenu(\Twig_Environment $environment, $menuIdentifier, $depth = 1)
{
$queryBuilder = $this->repo->getNodesHierarchyQueryBuilder(null, false, array(), true)
->join('ClasticMenuBundle:Menu', 'menu', 'menu.id = node.menu')
->andWhere('menu.identifier = :identifier')
->setParameter('identifier', $menuIdentifier);

$globals = $this->environment->getGlobals();
$globals = $environment->getGlobals();

/** @var GlobalVariables $variables */
$variables = $globals['app'];
Expand Down Expand Up @@ -94,7 +90,7 @@ public function renderMenu($menuIdentifier, $depth = 1)
);
}, $queryBuilder->getQuery()->getResult());

return $this->environment->render('ClasticMenuBundle:Twig:menu.html.twig', array(
return $environment->render('ClasticMenuBundle:Twig:menu.html.twig', array(
'tree' => $this->repo->buildTree($items),
));
}
Expand Down

0 comments on commit fb5a834

Please sign in to comment.