/** * Overrides base class to determine if the content has pxe context assigned, and if so * process it accordingly. If the content element has a pxe tag (which would only be a span) then process the tag, * add the content, and close the tag.. otherwise just add the content normally * and let the pxe producer handle wrapping tags * @param IdmlContent $element * @param int $depth */ public function visitContentEnd(IdmlContent $element, $depth = 0) { if (!$element->hasContent()) { //skip empty content tags return; } if (IdmlPxeHelper::hasPxeTag($element)) { parent::visitContentEnd($element, $depth); $this->closeElement($element, $depth); } elseif (IdmlPxeHelper::hasPxeParents($element)) { //get last parent and put this content inside it by assigning it $parents = IdmlPxeHelper::getPxeParents($element, true); if (count($parents) > 0) { parent::visitContentEnd($element, $depth); $this->closeElement($element, $depth); } } else { parent::visitContentEnd($element, $depth); } }
public function visitContent(IdmlContent $element, $depth = 0) { $this->verifyParentStructure(); if (!$element->hasContent()) { //skip empty content tags return; } $parentTag = $this->getParentTag(); $pxeParent = $this->getPxeParent($element); if (!$this->pxeRules->canContainText($parentTag) || !is_object($pxeParent)) { if ($pxeParent) { $this->pushTagToElement($pxeParent, "p", IdmlPxeHelper::getNewTagHash()); } else { $parents = implode(' ', $this->parentStack); $this->setPxeAttributes($element, "span", $parents, IdmlPxeHelper::getNewTagHash()); } } }