Add UIBlocks to twig (new blocks)

This commit is contained in:
Eric
2021-01-13 18:25:37 +01:00
parent 77808ecd41
commit bffb7b5eab
10 changed files with 242 additions and 25 deletions

View File

@@ -0,0 +1,41 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\TwigBase\UI\Component;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class UITitleParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token)
{
$iLineno = $token->getLine();
$oStream = $this->parser->getStream();
$sType = $oStream->expect(Token::NAME_TYPE)->getValue();
$oParams = $this->parser->getExpressionParser()->parseExpression();
$oStream->expect(Token::BLOCK_END_TYPE);
return new UITitleNode($sType, $oParams, $iLineno, $this->getTag());
}
/**
* @inheritDoc
*/
public function getTag()
{
return 'UITitle';
}
}