aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template/twig/tokenparser
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-06-10 00:59:06 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2013-06-10 00:59:06 -0500
commit9f8f500ba33963a28c656af8a28a9a6521af4616 (patch)
tree322708a8a772c13571bf2b1fc8ea304aa0bcc822 /phpBB/includes/template/twig/tokenparser
parent87cc8af26565dc1547383aa8c969cc5be48f0944 (diff)
downloadforums-9f8f500ba33963a28c656af8a28a9a6521af4616.tar
forums-9f8f500ba33963a28c656af8a28a9a6521af4616.tar.gz
forums-9f8f500ba33963a28c656af8a28a9a6521af4616.tar.bz2
forums-9f8f500ba33963a28c656af8a28a9a6521af4616.tar.xz
forums-9f8f500ba33963a28c656af8a28a9a6521af4616.zip
[feature/twig] Working on DEFINE
PHPBB3-11598
Diffstat (limited to 'phpBB/includes/template/twig/tokenparser')
-rw-r--r--phpBB/includes/template/twig/tokenparser/define.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/phpBB/includes/template/twig/tokenparser/define.php b/phpBB/includes/template/twig/tokenparser/define.php
new file mode 100644
index 0000000000..8eb33c7ff9
--- /dev/null
+++ b/phpBB/includes/template/twig/tokenparser/define.php
@@ -0,0 +1,45 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Defines a variable.
+ *
+ * <pre>
+ * {% set foo = 'foo' %}
+ *
+ * {% set foo = [1, 2] %}
+ *
+ * {% set foo = {'foo': 'bar'} %}
+ *
+ * {% set foo = 'foo' ~ 'bar' %}
+ *
+ * {% set foo, bar = 'foo', 'bar' %}
+ *
+ * {% set foo %}Some content{% endset %}
+ * </pre>
+ */
+class phpbb_template_twig_tokenparser_define extends Twig_TokenParser_Set
+{
+ public function decideBlockEnd(Twig_Token $token)
+ {
+ return $token->test('ENDDEFINE');
+ }
+
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @return string The tag name
+ */
+ public function getTag()
+ {
+ return 'DEFINE';
+ }
+}