public function YouTubePlaylist::renderEmbedCode in Video Embed Field 8
Same name and namespace in other branches
- 8.2 src/Plugin/video_embed_field/Provider/YouTubePlaylist.php \Drupal\video_embed_field\Plugin\video_embed_field\Provider\YouTubePlaylist::renderEmbedCode()
Render embed code.
Parameters
string $width: The width of the video player.
string $height: The height of the video player.
bool $autoplay: If the video should autoplay.
Return value
mixed A renderable array of the embed code.
Overrides ProviderPluginInterface::renderEmbedCode
File
- src/
Plugin/ video_embed_field/ Provider/ YouTubePlaylist.php, line 20
Class
- YouTubePlaylist
- A YouTube playlist video provider.
Namespace
Drupal\video_embed_field\Plugin\video_embed_field\ProviderCode
public function renderEmbedCode($width, $height, $autoplay) {
return [
'#type' => 'video_embed_iframe',
'#provider' => 'youtube_playlist',
'#url' => 'https://www.youtube.com/embed/videoseries',
'#query' => [
'list' => $this
->getVideoId(),
],
'#attributes' => [
'width' => $width,
'height' => $height,
'frameborder' => '0',
'allowfullscreen' => 'allowfullscreen',
],
];
}