From 917f62b7dc35b8f4468254b02be825774b5965e0 Mon Sep 17 00:00:00 2001
From: Kevin Paxman <kpaxman@uwaterloo.ca>
Date: Fri, 3 Jan 2025 15:26:41 -0500
Subject: [PATCH] ISTWCMS-7241: add identifier for YouTube playlists

---
 src/EventSubscriber/UwCblRemoteVideoEventSubscriber.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/EventSubscriber/UwCblRemoteVideoEventSubscriber.php b/src/EventSubscriber/UwCblRemoteVideoEventSubscriber.php
index 9e48644a..e01f7148 100644
--- a/src/EventSubscriber/UwCblRemoteVideoEventSubscriber.php
+++ b/src/EventSubscriber/UwCblRemoteVideoEventSubscriber.php
@@ -69,6 +69,12 @@ class UwCblRemoteVideoEventSubscriber extends UwCblBase implements EventSubscrib
         // Set the type of video to YouTube.
         $remote_video['view']['type'] = 'YouTube';
       }
+      // Check for YouTube playlist.
+      elseif (preg_match($pattern = '/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/(playlist\?list=)([a-zA-Z0-9_-]+)$/', $remote_video['view']['url'])) {
+
+        // Set the type of video to YouTube playlist
+        $remote_video['view']['type'] = 'YouTube playlist';
+      }
       // Check for Vimeo.
       elseif (strrpos($remote_video['view']['url'], 'vimeo')) {
 
-- 
GitLab