public function apply($transformer, $text_container, $element) { $anchor = Anchor::create(); $url = $this->getProperty(self::PROPERTY_ANCHOR_HREF, $element); $rel = $this->getProperty(self::PROPERTY_ANCHOR_REL, $element); if ($url) { $anchor->withHref($url); } if ($rel) { $anchor->withRel($rel); } $text_container->appendText($anchor); $transformer->transform($anchor, $element); return $text_container; }
/** * Structure and create the full ArticleVideo in a XML format DOMElement. * * @param \DOMDocument $document where this element will be appended. Optional * * @return \DOMElement */ public function toDOMElement($document = null) { if (!$document) { $document = new \DOMDocument(); } if (!$this->isValid()) { return $this->emptyElement($document); } $element = $document->createElement('li'); if ($this->sponsored) { $element->setAttribute('data-sponsored', 'true'); } $element->appendChild(Anchor::create()->withHref($this->url)->toDOMElement($document)); return $element; }