protected function UrlToVideoFilterService::convertVimeoUrlToEmbedCode in URL to Video Filter 2.0.x
Same name and namespace in other branches
- 8 src/Service/UrlToVideoFilterService.php \Drupal\url_to_video_filter\Service\UrlToVideoFilterService::convertVimeoUrlToEmbedCode()
Converts Vimeo URL to HTML placeholders.
Note that ths function only embeds placeholders into the HTML. The actual content, whether that be a clickable thumbnail, or the embedded video itself, is injected into the HTML with JavaScript, replacing the placeholders this function embeds.
Parameters
string $url: The Vimeo URL to convert.
Return value
string HTML containing the placeholder for the Vimeo video for the given URL.
1 call to UrlToVideoFilterService::convertVimeoUrlToEmbedCode()
- UrlToVideoFilterService::convertVimeoUrls in src/
Service/ UrlToVideoFilterService.php - Converts URLs to embedded Vimeo videos.
File
- src/
Service/ UrlToVideoFilterService.php, line 150
Class
- UrlToVideoFilterService
- Service class for the URL To Video Filter module.
Namespace
Drupal\url_to_video_filter\ServiceCode
protected function convertVimeoUrlToEmbedCode($url) {
$embed_code = '';
$video_key = preg_replace('/(http)?(s)?(:\\/\\/)?(www\\.)?vimeo\\.com\\//', '', $url);
$embed_code .= '<span class="url-to-video-container vimeo-container no-js">';
$embed_code .= '<span class="vimeo-player url-to-video-player loader" data-vimeo-id="' . $video_key . '"></span>';
$embed_code .= '</span>';
return $embed_code;
}