public function Vimeo::renderEmbedCode in Video 8
Same name and namespace in other branches
- 8.2 src/Plugin/video/Provider/Vimeo.php \Drupal\video\Plugin\video\Provider\Vimeo::renderEmbedCode()
Render embed code.
Parameters
string $settings: The settings of the video player.
Return value
mixed A renderable array of the embed code.
Overrides ProviderPluginInterface::renderEmbedCode
File
- src/
Plugin/ video/ Provider/ Vimeo.php, line 25
Class
- Vimeo
- Plugin annotation @VideoEmbeddableProvider( id = "vimeo", label = @Translation("Vimeo"), description = @Translation("Vimeo Video Provider"), regular_expressions = { "/^https?:\/\/(www\.)?vimeo.com\/(?<id>[0-9]*)/", }, mimetype =…
Namespace
Drupal\video\Plugin\video\ProviderCode
public function renderEmbedCode($settings) {
$file = $this
->getVideoFile();
$data = $this
->getVideoMetadata();
return [
'#type' => 'html_tag',
'#tag' => 'iframe',
'#attributes' => [
'width' => $settings['width'],
'height' => $settings['height'],
'frameborder' => '0',
'allowfullscreen' => 'allowfullscreen',
'src' => sprintf('https://player.vimeo.com/video/%s?autoplay=%d', $data['id'], $settings['autoplay']),
],
];
}