This commit is contained in:
bzick
2014-06-28 22:15:30 +04:00
parent 6b8ddd4ecc
commit c56623c1a4
3 changed files with 38 additions and 2 deletions

View File

@@ -282,6 +282,10 @@ class Fenom
'type' => self::BLOCK_COMPILER,
'open' => 'Fenom\Compiler::ignoreOpen',
'close' => 'Fenom\Compiler::nope'
),
'unset' => array(
'type' => self::INLINE_COMPILER,
'parser' => 'Fenom\Compiler::tagUnset'
)
);

View File

@@ -1007,4 +1007,19 @@ class Compiler
{
$tag->tpl->ignore('ignore');
}
/**
* Tag {unset ...}
* @param Tokenizer $tokens
* @param Tag $tag
* @return string
*/
public static function tagUnset(Tokenizer $tokens, Tag $tag)
{
$unset = [];
while($tokens->valid()) {
$unset[] = $tag->tpl->parseVariable($tokens);
}
return 'unset('.implode(", ", $unset).')';
}
}