Source of file ActionsExtension.php
Size: 1,672 Bytes - Last Modified: 2013-07-17T08:22:21+02:00
/home/theseer/Downloads/Symfony/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bundle\TwigBundle\Extension; use Symfony\Bundle\TwigBundle\TokenParser\RenderTokenParser; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Twig extension for Symfony actions helper * * @author Fabien Potencier <fabien@symfony.com> */ class ActionsExtension extends \Twig_Extension { private $container; /** * Constructor. * * @param ContainerInterface $container The service container */ public function __construct(ContainerInterface $container) { $this->container = $container; } /** * Returns the Response content for a given URI. * * @param string $uri A URI * @param array $options An array of options * * @see Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver::render() */ public function renderUri($uri, array $options = array()) { return $this->container->get('templating.helper.actions')->render($uri, $options); } /** * Returns the token parser instance to add to the existing list. * * @return array An array of Twig_TokenParser instances */ public function getTokenParsers() { return array( // {% render url('post_list', { 'limit': 2 }), { 'alt': 'BlogBundle:Post:error' } %} new RenderTokenParser(), ); } public function getName() { return 'actions'; } } |