X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fvideo_embed_field%2Fsrc%2FPlugin%2FField%2FFieldFormatter%2FVideo.php;fp=web%2Fmodules%2Fcontrib%2Fvideo_embed_field%2Fsrc%2FPlugin%2FField%2FFieldFormatter%2FVideo.php;h=361207a728f52e90175cc78ae9bd0833afd2cf04;hp=152b524fb9e9ba29b5e63cf9fbd0c5d7b41fe492;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/modules/contrib/video_embed_field/src/Plugin/Field/FieldFormatter/Video.php b/web/modules/contrib/video_embed_field/src/Plugin/Field/FieldFormatter/Video.php index 152b524fb..361207a72 100644 --- a/web/modules/contrib/video_embed_field/src/Plugin/Field/FieldFormatter/Video.php +++ b/web/modules/contrib/video_embed_field/src/Plugin/Field/FieldFormatter/Video.php @@ -2,6 +2,7 @@ namespace Drupal\video_embed_field\Plugin\Field\FieldFormatter; +use Drupal\Component\Utility\Html; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FormatterBase; use Drupal\Core\Field\FieldItemListInterface; @@ -100,14 +101,16 @@ class Video extends FormatterBase implements ContainerFactoryPluginInterface { $element[$delta] = $provider->renderEmbedCode($this->getSetting('width'), $this->getSetting('height'), $autoplay); $element[$delta]['#cache']['contexts'][] = 'user.permissions'; + $element[$delta] = [ + '#type' => 'container', + '#attributes' => ['class' => [Html::cleanCssIdentifier(sprintf('video-embed-field-provider-%s', $provider->getPluginId()))]], + 'children' => $element[$delta], + ]; + // For responsive videos, wrap each field item in it's own container. if ($this->getSetting('responsive')) { - $element[$delta] = [ - '#type' => 'container', - '#attached' => ['library' => ['video_embed_field/responsive-video']], - '#attributes' => ['class' => ['video-embed-field-responsive-video']], - 'children' => $element[$delta], - ]; + $element[$delta]['#attached']['library'][] = 'video_embed_field/responsive-video'; + $element[$delta]['#attributes']['class'][] = 'video-embed-field-responsive-video'; } }