in src/Facebook/InstantArticles/Transformer/Rules/SocialEmbedRule.php [55:106]
public function apply($transformer, $instant_article, $node)
{
$social_embed = SocialEmbed::create();
// Builds the image
$iframe = $this->getProperty(self::PROPERTY_IFRAME, $node);
$url = $this->getProperty(self::PROPERTY_URL, $node);
if ($iframe) {
$social_embed->withHTML(Transformer::cloneNode($iframe));
}
if ($url) {
$social_embed->withSource($url);
}
if ($iframe || $url) {
$instant_article->addChild($social_embed);
} else {
$transformer->addWarning(
new InvalidSelector(
'iframe and/or url',
$instant_article,
$node,
$this
)
);
}
// Dimensions
$width = $this->getProperty(self::PROPERTY_WIDTH, $node);
$height = $this->getProperty(self::PROPERTY_HEIGHT, $node);
if ($width) {
$social_embed->withWidth($width);
}
if ($height) {
$social_embed->withHeight($height);
}
$suppress_warnings = $transformer->suppress_warnings;
$transformer->suppress_warnings = true;
$transformer->transform($social_embed, $node);
$transformer->suppress_warnings = $suppress_warnings;
$transformer->addWarning(
new DeprecatedRuleWarning(
'The rule SocialEmbedRule is deprecated. Use InteractiveRule instead.',
$instant_article,
$node,
$this
)
);
return $instant_article;
}