protected function applyFilters(Twig_Node $node) { if (false === ($filters = $this->getCurrentFilters())) { return $node; } if ($node instanceof Twig_Node_Text) { $expression = new Twig_Node_Expression_Constant($node->getData(), $node->getLine()); } else { $expression = $node->getExpression(); } // filters if ($expression instanceof Twig_Node_Expression_Filter) { $expression->appendFilters($filters); return $node; } else { return new Twig_Node_Print(new Twig_Node_Expression_Filter($expression, $filters, $node->getLine()), $node->getLine()); } }