in src/Facebook/InstantArticles/Transformer/Rules/SlideshowImageRule.php [49:83]
public function apply($transformer, $slideshow, $node)
{
$image = Image::create();
// Builds the image
$url = $this->getProperty(self::PROPERTY_IMAGE_URL, $node);
if ($url) {
$image->withURL($url);
$slideshow->addImage($image);
} else {
$transformer->addWarning(
new InvalidSelector(
self::PROPERTY_IMAGE_URL,
$slideshow,
$node,
$this
)
);
}
$caption = Caption::create();
$caption_title = $this->getProperty(self::PROPERTY_CAPTION_TITLE, $node);
if ($caption_title) {
$caption->withTitle($caption_title);
$image->withCaption($caption);
}
$caption_credit = $this->getProperty(self::PROPERTY_CAPTION_CREDIT, $node);
if ($caption_credit) {
$caption->withCredit($caption_credit);
}
return $slideshow;
}