* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * * @package Symfony * @subpackage Framework_TwigBundle * @author Fabien Potencier */ class Helpers extends \Twig_Extension { /** * Returns the token parser instance to add to the existing list. * * @return array An array of Twig_TokenParser instances */ public function getTokenParsers() { return array( // {% javascript 'bundles/blog/js/blog.js' %} new HelperTokenParser('javascript', ' [with ]', 'javascripts', 'add'), // {% javascripts %} new HelperTokenParser('javascripts', '', 'javascripts', 'render'), // {% stylesheet 'bundles/blog/css/blog.css' with ['media': 'screen'] %} new HelperTokenParser('stylesheet', ' [with ]', 'stylesheets', 'add'), // {% stylesheets %} new HelperTokenParser('stylesheets', '', 'stylesheets', 'render'), // {% route 'blog_post' with ['id': post.id] %} new HelperTokenParser('route', ' [with ]', 'router', 'generate'), // {% render 'BlogBundle:Post:list' with ['path': ['limit': 2], 'alt': 'BlogBundle:Post:error'] %} new HelperTokenParser('render', '