[ Index ] |
PHP Cross Reference of phpBB-3.3.14-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 $only = false; 39 40 if ($this->parser->getStream()->test(Token::NAME_TYPE, 'with')) { 41 $this->parser->getStream()->next(); 42 $resources = $this->parser->getExpressionParser()->parseExpression(); 43 44 if ($this->parser->getStream()->nextIf(Token::NAME_TYPE, 'only')) { 45 $only = true; 46 } 47 } else { 48 $resources = new ArrayExpression([], $stream->getCurrent()->getLine()); 49 do { 50 $resources->addElement($this->parser->getExpressionParser()->parseExpression()); 51 } while (!$stream->test(Token::BLOCK_END_TYPE)); 52 } 53 54 $stream->expect(Token::BLOCK_END_TYPE); 55 56 return new FormThemeNode($form, $resources, $lineno, $this->getTag(), $only); 57 } 58 59 /** 60 * Gets the tag name associated with this token parser. 61 * 62 * @return string The tag name 63 */ 64 public function getTag() 65 { 66 return 'form_theme'; 67 } 68 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |