Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / video_embed_field / modules / video_embed_wysiwyg / src / Plugin / Filter / VideoEmbedWysiwyg.php
index 7334122938618a72dd0c51b5361d15c3cbfe3297..f0c50e77f974f4c9b91f0fb4fdf7bcf8c2825c72 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Drupal\video_embed_wysiwyg\Plugin\Filter;
 
+use Drupal\Component\Utility\Html;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Session\AccountProxyInterface;
 use Drupal\filter\FilterProcessResult;
@@ -89,18 +90,20 @@ class VideoEmbedWysiwyg extends FilterBase implements ContainerFactoryPluginInte
       $autoplay = $this->currentUser->hasPermission('never autoplay videos') ? FALSE : $embed_data['settings']['autoplay'];
       $embed_code = $provider->renderEmbedCode($embed_data['settings']['width'], $embed_data['settings']['height'], $autoplay);
 
+      $embed_code = [
+        '#type' => 'container',
+        '#attributes' => [
+          'class' => [Html::cleanCssIdentifier(sprintf('video-embed-field-provider-%s', $provider->getPluginId()))],
+        ],
+        'children' => $embed_code,
+      ];
+
       // Add the container to make the video responsive if it's been
       // configured as such. This usually is attached to field output in the
       // case of a formatter, but a custom container must be used where one is
       // not present.
       if ($embed_data['settings']['responsive']) {
-        $embed_code = [
-          '#type' => 'container',
-          '#attributes' => [
-            'class' => ['video-embed-field-responsive-video'],
-          ],
-          'children' => $embed_code,
-        ];
+        $embed_code['#attributes']['class'][] = 'video-embed-field-responsive-video';
       }
 
       // Replace the JSON settings with a video.