public function toDOMElement()

in src/Facebook/InstantArticles/Elements/Interactive.php [196:237]


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

        $figure = $document->createElement('figure');
        $iframe = $document->createElement('iframe');

        $figure->appendChild($iframe);
        $figure->setAttribute('class', 'op-interactive');

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

        if ($this->source) {
            $iframe->setAttribute('src', $this->source);
        }

        if ($this->margin) {
            $iframe->setAttribute('class', $this->margin);
        }

        if ($this->width) {
            $iframe->setAttribute('width', $this->width);
        }

        if ($this->height) {
            $iframe->setAttribute('height', $this->height);
        }

        // Ad markup
        if ($this->html) {
            // Here we do not care about what is inside the iframe
            // because it'll be rendered in a sandboxed webview
            $this->dangerouslyAppendUnescapedHTML($iframe, $this->html);
        } else {
            $iframe->appendChild($document->createTextNode(''));
        }

        return $figure;
    }