public function toDOMElement()

in src/Facebook/InstantArticles/Elements/Slideshow.php [199:231]


    public function toDOMElement($document = null)
    {
        if (!$document) {
            $document = new \DOMDocument();
        }

        $element = $document->createElement('figure');
        $element->setAttribute('class', 'op-slideshow');

        // URL markup required
        if ($this->article_images) {
            foreach ($this->article_images as $article_image) {
                Element::appendChild($element, $article_image, $document);
            }
        }

        // Caption markup optional
        Element::appendChild($element, $this->caption, $document);

        // Geotag markup optional
        if ($this->geotag) {
            $script_element = $document->createElement('script');
            $script_element->setAttribute('type', 'application/json');
            $script_element->setAttribute('class', 'op-geotag');
            $script_element->appendChild($document->createTextNode($this->geotag));
            $element->appendChild($script_element);
        }

        // Audio markup optional
        Element::appendChild($element, $this->audio, $document);

        return $element;
    }