Created
March 4, 2013 16:05
-
-
Save daum/5083295 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Knp\Bundle\MenuBundle\DependencyInjection\Compiler; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | |
/** | |
* This compiler pass adds the path for the KnpMenu template in the twig loader. | |
* | |
* @author Christophe Coevoet <[email protected]> | |
*/ | |
class AddTemplatePathPass implements CompilerPassInterface | |
{ | |
public function process(ContainerBuilder $container) | |
{ | |
if (!$container->hasDefinition('twig.loader')) { | |
return; | |
} | |
$refl = new \ReflectionClass('Knp\Menu\ItemInterface'); | |
$path = dirname($refl->getFileName()).'/Resources/views'; | |
var_dump($path);die(); | |
$container->getDefinition('twig.loader')->addMethodCall('addPath', array($path)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment