protected function processTag(DOMDocument $document, DOMElement $tag)
{
$content = null;
$tagName = $tag->getAttribute('name');
$parameters = array('name' => $tagName, 'params' => $this->extractConfiguration($tag));
if ($tag->getElementsByTagName('ezcontent')->length > 0) {
$parameters['content'] = $this->saveNodeXML($tag->getElementsByTagName('ezcontent')->item(0));
}
if ($tag->hasAttribute('xlink:align')) {
$parameters['align'] = $tag->getAttribute('xlink:align');
}
$content = $this->renderer->renderTag($tagName, $parameters, $tag->localName === 'eztemplateinline');
if (isset($content)) {
// If current tag is wrapped inside another template tag we can't use CDATA section
// for its content as these can't be nested.
// CDATA section will be used only for content of root wrapping tag, content of tags
// inside it will be added as XML fragments.
if ($this->isWrapped($tag)) {
$fragment = $document->createDocumentFragment();
$fragment->appendXML($content);
$tag->parentNode->replaceChild($fragment, $tag);
} else {
$payload = $document->createElement('ezpayload');
$payload->appendChild($document->createCDATASection($content));
$tag->appendChild($payload);
}
}
}