protected static function YouTubePlaylist::getUrlComponent 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::getUrlComponent()
Get a component from the URL.
Parameters
string $input: The input URL.
string $component: The component from the regex to get.
Return value
string The value of the match in the regex.
2 calls to YouTubePlaylist::getUrlComponent()
- YouTubePlaylist::getIdFromInput in src/
Plugin/ video_embed_field/ Provider/ YouTubePlaylist.php - Get the ID of the video from user input.
- YouTubePlaylist::getRemoteThumbnailUrl in src/
Plugin/ video_embed_field/ Provider/ YouTubePlaylist.php - Get the URL of the remote thumbnail.
File
- src/
Plugin/ video_embed_field/ Provider/ YouTubePlaylist.php, line 62
Class
- YouTubePlaylist
- A YouTube playlist video provider.
Namespace
Drupal\video_embed_field\Plugin\video_embed_field\ProviderCode
protected static function getUrlComponent($input, $component) {
preg_match('/^https?:\\/\\/(?:www\\.)?youtube\\.com\\/watch\\?(?=.*v=(?<video_id>[0-9A-Za-z_-]*))(?=.*list=(?<id>[A-Za-z0-9_-]*))/', $input, $matches);
return isset($matches[$component]) ? $matches[$component] : FALSE;
}