Skip to content
Snippets Groups Projects
Commit 59ec4bd4 authored by Kevin Paxman's avatar Kevin Paxman
Browse files

Merge branch 'feature/ISTWCMS-7251-kpaxman-video_titles' into '1.1.x'

ISTWCMS-7251: provide the media item title to the theming

See merge request !259
parents 205b92e1 bfdfadbb
No related branches found
No related tags found
1 merge request!259ISTWCMS-7251: provide the media item title to the theming
...@@ -63,6 +63,9 @@ class UwCblRemoteVideoEventSubscriber extends UwCblBase implements EventSubscrib ...@@ -63,6 +63,9 @@ class UwCblRemoteVideoEventSubscriber extends UwCblBase implements EventSubscrib
// Set the remote video URL. // Set the remote video URL.
$remote_video['view']['url'] = $media->field_media_oembed_video->value; $remote_video['view']['url'] = $media->field_media_oembed_video->value;
// Set the remote video title.
$remote_video['view']['title'] = $media->label();
// Check for YouTube. // Check for YouTube.
if (preg_match('/^https?:\/\/(?:(?:www\.)?youtube(?:-nocookie)?\.com\/(?:watch\?(?:\S+&)?v=|embed\/|.+#.+\/)|youtu\.be\/)(?:[\w\-]{11})(?:[#&?]\S*)?$/', $remote_video['view']['url'])) { if (preg_match('/^https?:\/\/(?:(?:www\.)?youtube(?:-nocookie)?\.com\/(?:watch\?(?:\S+&)?v=|embed\/|.+#.+\/)|youtu\.be\/)(?:[\w\-]{11})(?:[#&?]\S*)?$/', $remote_video['view']['url'])) {
...@@ -70,11 +73,17 @@ class UwCblRemoteVideoEventSubscriber extends UwCblBase implements EventSubscrib ...@@ -70,11 +73,17 @@ class UwCblRemoteVideoEventSubscriber extends UwCblBase implements EventSubscrib
$remote_video['view']['type'] = 'YouTube'; $remote_video['view']['type'] = 'YouTube';
} }
// Check for YouTube playlist. // Check for YouTube playlist.
elseif (preg_match($pattern = '/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/(playlist\?list=)([a-zA-Z0-9_-]+)$/', $remote_video['view']['url'])) { elseif (preg_match('/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/(playlist\?list=)([a-zA-Z0-9_-]+)$/', $remote_video['view']['url'])) {
// Set the type of video to YouTube playlist. // Set the type of video to YouTube playlist.
$remote_video['view']['type'] = 'YouTube playlist'; $remote_video['view']['type'] = 'YouTube playlist';
} }
// Check for YouTube short.
elseif (preg_match('/https?:\/\/(www\.)?youtube\.com\/shorts\/[a-zA-Z0-9_-]+/', $remote_video['view']['url'])) {
// Set the type of video to YouTube short.
$remote_video['view']['type'] = 'YouTube short';
}
// Check for Vimeo. // Check for Vimeo.
elseif (strrpos($remote_video['view']['url'], 'vimeo')) { elseif (strrpos($remote_video['view']['url'], 'vimeo')) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment