JavascriptsTokenParser.php 970 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Symfony\Framework\TwigBundle\TokenParser;
  3. use Symfony\Framework\TwigBundle\Node\HelperNode;
  4. /*
  5. * This file is part of the Symfony package.
  6. *
  7. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  8. *
  9. * For the full copyright and license information, please view the LICENSE
  10. * file that was distributed with this source code.
  11. */
  12. /**
  13. * Wrapper for the javascripts helper output() method.
  14. *
  15. * {% javascripts %}
  16. *
  17. * @package Symfony
  18. * @subpackage Framework_TwigBundle
  19. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  20. */
  21. class JavascriptsTokenParser extends \Twig_TokenParser
  22. {
  23. public function parse(\Twig_Token $token)
  24. {
  25. $this->parser->getStream()->expect(\Twig_Token::BLOCK_END_TYPE);
  26. return new HelperNode('javascripts', 'render', new \Twig_NodeList(array()), true, $token->getLine(), $this->getTag());
  27. }
  28. public function getTag()
  29. {
  30. return 'javascripts';
  31. }
  32. }