From 1d2e51d2b3d0ef07f5f6fbf5d12499e7f62b7895 Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Sat, 27 Nov 2021 17:44:01 -0500 Subject: [PATCH] Another last minute fix. Wrong min height on Video Why did I refactor? Well, embargoes. Never forget. This was inheriting some Audio CSS which is different --- .../FieldFormatter/StrawberryVideoFormatter.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Plugin/Field/FieldFormatter/StrawberryVideoFormatter.php b/src/Plugin/Field/FieldFormatter/StrawberryVideoFormatter.php index 232789ec..c3c206a7 100644 --- a/src/Plugin/Field/FieldFormatter/StrawberryVideoFormatter.php +++ b/src/Plugin/Field/FieldFormatter/StrawberryVideoFormatter.php @@ -165,6 +165,8 @@ public function viewElements(FieldItemListInterface $items, $langcode) { $max_width_css = empty($max_width) || $max_width == 0 ? '100%' : $max_width .'px'; $max_height = $this->getSetting('max_height'); $max_height_css = empty($max_height) || $max_height == 0 ? 'auto' : $max_height .'px'; + // Basically min 90px height if using VTT + $max_height_vtt_css = empty($max_height) || $max_height == 0 ? 'auto' : ($max_height <= 90 ? 90 : $max_height) .'px'; $current_language = $items->getEntity()->get('langcode')->value; $nodeid = $items->getEntity()->id(); @@ -264,18 +266,11 @@ public function viewElements(FieldItemListInterface $items, $langcode) { */ if (count($vtt)) { // Yep, redundant but we have no longer these settings here - // and i need to add 30px (uff) to the top. - - if ($max_height = $this->getSetting('max_height') <= 90) { - $max_width = $this->getSetting('max_width'); - $max_height = 90; - $max_width_css = empty($max_width) || $max_width == 0 ? '100%' : $max_width . 'px'; - } foreach ($media as $drforkey => $media_item) { if (isset($vtt[$drforkey])) { foreach ($media_item as $key => $media_entry) { - $elements[$delta]['video_hmtl5_' . $key]['video']['#attributes']['style'] = "width:{$max_width_css}; height:{$max_height}px"; + $elements[$delta]['video_hmtl5_' . $key]['video']['#attributes']['style'] = "width:{$max_width_css}; height:{$max_height_vtt_css}"; foreach ($vtt[$drforkey] as $vtt_key => &$vtt_item) { $route_parameters = [ 'node' => $nodeid, @@ -379,7 +374,7 @@ protected function generateElementForItem(int $delta, FieldItemListInterface $it 'class' => ['field-av', 'video-av'], 'id' => 'video_' . $uniqueid, 'controls' => TRUE, - 'style' => "width:{$max_width_css}; height:{$max_height_css}px", + 'style' => "width:{$max_width_css}; height:{$max_height_css}", ], '#alt' => $this->t( 'Audio for @label', @@ -401,4 +396,4 @@ protected function generateElementForItem(int $delta, FieldItemListInterface $it ]; $elements[$delta]['#attached']['library'][] = 'format_strawberryfield/av_strawberry'; } -} \ No newline at end of file +}