Backward incompatibilities:
* The short notation of the `block` tag changed.
+ * added a way to add token parsers, filters, and visitors without creating an extension
* added three interfaces: Twig_NodeInterface, Twig_TokenParserInterface, and Twig_FilterInterface
* changed the generated code to match the new coding standards
* fixed sandbox mode (__toString() method check was not enforced if called implicitly from a simple statement like {{ article }})
return $this->extensions;
}
+ public function addTokenParser(Twig_TokenParserInterface $parser)
+ {
+ if (null === $this->parsers) {
+ $this->getTokenParsers();
+ }
+
+ $this->parsers[] = $parser;
+ }
+
public function getTokenParsers()
{
if (null === $this->parsers) {
return $this->parsers;
}
+ public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
+ {
+ if (null === $this->visitors) {
+ $this->getNodeVisitors();
+ }
+
+ $this->visitors[] = $visitor;
+ }
+
public function getNodeVisitors()
{
if (null === $this->visitors) {
return $this->visitors;
}
+ public function addFilter($name, Twig_NodeFilter $filter)
+ {
+ if (null === $this->filters) {
+ $this->getFilters();
+ }
+
+ $this->filters[$name] = $filter;
+ }
+
public function getFilters()
{
if (null === $this->filters) {