in src/Facebook/InstantArticles/Elements/Ad.php [164:202]
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-ad'
.($this->isDefaultForReuse ? ' op-ad-default' : '')
);
if ($this->source) {
$iframe->setAttribute('src', $this->source);
}
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;
}