[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Bridge\Twig\TokenParser; 13 14 use Symfony\Bridge\Twig\Node\FormThemeNode; 15 use Twig\Node\Expression\ArrayExpression; 16 use Twig\Node\Node; 17 use Twig\Token; 18 use Twig\TokenParser\AbstractTokenParser; 19 20 /** 21 * Token Parser for the 'form_theme' tag. 22 * 23 * @author Fabien Potencier <fabien@symfony.com> 24 */ 25 class FormThemeTokenParser extends AbstractTokenParser 26 { 27 /** 28 * Parses a token and returns a node. 29 * 30 * @return Node 31 */ 32 public function parse(Token $token) 33 { 34 $lineno = $token->getLine(); 35 $stream = $this->parser->getStream(); 36 37 $form = $this->parser->getExpressionParser()->parseExpression(); 38 39 if ($this->parser->getStream()->test(Token::NAME_TYPE, 'with')) { 40 $this->parser->getStream()->next(); 41 $resources = $this->parser->getExpressionParser()->parseExpression(); 42 } else { 43 $resources = new ArrayExpression(array(), $stream->getCurrent()->getLine()); 44 do { 45 $resources->addElement($this->parser->getExpressionParser()->parseExpression()); 46 } while (!$stream->test(Token::BLOCK_END_TYPE)); 47 } 48 49 $stream->expect(Token::BLOCK_END_TYPE); 50 51 return new FormThemeNode($form, $resources, $lineno, $this->getTag()); 52 } 53 54 /** 55 * Gets the tag name associated with this token parser. 56 * 57 * @return string The tag name 58 */ 59 public function getTag() 60 { 61 return 'form_theme'; 62 } 63 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |