/** * Adds a ViewHelper node using the Format\HtmlspecialcharsViewHelper to the given node. * If "escapingInterceptorEnabled" in the ViewHelper is FALSE, will disable itself inside the ViewHelpers body. * * @param NodeInterface $node * @param integer $interceptorPosition One of the INTERCEPT_* constants for the current interception point * @param ParsingState $parsingState the current parsing state. Not needed in this interceptor. * @return NodeInterface */ public function process(NodeInterface $node, $interceptorPosition, ParsingState $parsingState) { $resolver = $parsingState->getViewHelperResolver(); if ($interceptorPosition === InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER) { /** @var ViewHelperNode $node */ if (!$node->getUninitializedViewHelper()->isChildrenEscapingEnabled()) { $this->childrenEscapingEnabled = FALSE; $this->viewHelperNodesWhichDisableTheInterceptor[] = $node; } } elseif ($interceptorPosition === InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER) { if (end($this->viewHelperNodesWhichDisableTheInterceptor) === $node) { array_pop($this->viewHelperNodesWhichDisableTheInterceptor); if (count($this->viewHelperNodesWhichDisableTheInterceptor) === 0) { $this->childrenEscapingEnabled = TRUE; } } /** @var ViewHelperNode $node */ if ($this->childrenEscapingEnabled && $node->getUninitializedViewHelper()->isOutputEscapingEnabled()) { $node = $this->wrapNode($node, $resolver, $parsingState); } } elseif ($this->childrenEscapingEnabled && $node instanceof ObjectAccessorNode) { $node = $this->wrapNode($node, $resolver, $parsingState); } return $node; }