diff --git a/src/Service/UwNodeFieldValue.php b/src/Service/UwNodeFieldValue.php index f5cc929cfcec42f0781f57b3a5fed956327b594b..cc4f7033da97716887bf52705ee0175335a24072 100644 --- a/src/Service/UwNodeFieldValue.php +++ b/src/Service/UwNodeFieldValue.php @@ -250,6 +250,13 @@ class UwNodeFieldValue { // Set the banners as empty in case we do not have any. $banners = []; + // Get the layout builder style based from the node value + // of media width. + $layout_builder_style = $layout_style = \Drupal::entityTypeManager()->getStorage('layout_builder_style')->load($node->field_uw_media_width->value); + + // Get the classes associated with the layout builder style. + $media_width_classes = $layout_builder_style->getClasses(); + // Process banner images. foreach ($node->$field_name as $banner_item) { @@ -292,6 +299,7 @@ class UwNodeFieldValue { $banner['sources'] = $banner['image']['responsive_sources']; $banner['img_element'] = $banner['image']['img_element']['#uri']; $banner['alt'] = $banner['image']['alt']; + $banner['media_width'] = $media_width_classes; unset($banner['image']); }