private function DrupalInstantArticleDisplay::fieldFormatVideoElement in Facebook Instant Articles 7
Formatter for the Video element.
Parameters
$items:
Element $region:
$settings:
1 call to DrupalInstantArticleDisplay::fieldFormatVideoElement()
- DrupalInstantArticleDisplay::fieldFormatterView in modules/
fb_instant_articles_display/ src/ DrupalInstantArticleDisplay.php
File
- modules/
fb_instant_articles_display/ src/ DrupalInstantArticleDisplay.php, line 556 - Contains \Drupal\fb_instant_articles_display\DrupalInstantArticleDisplay.
Class
- DrupalInstantArticleDisplay
- Facebook Instant Article node wrapper class. Builds up an InstantArticle object using field formatters.
Namespace
Drupal\fb_instant_articles_displayCode
private function fieldFormatVideoElement($items, $region, $settings) {
foreach ($items as $delta => $item) {
$video = Video::create()
->withURL(file_create_url($item['uri']));
if ($region instanceof Header) {
$region
->withCover($video);
// If the video is for the cover, there can be only one.
break;
}
else {
if ($region instanceof InstantArticle) {
$region
->addChild($video);
}
}
}
}