Skip to content
Snippets Groups Projects
Commit 6cea2919 authored by Eric Bremner's avatar Eric Bremner Committed by Kevin Paxman
Browse files

ISTWCMS-5880: fixing getting media with in banners

parent 4997fcbc
No related branches found
No related tags found
3 merge requests!284Feature/istwcms 5880 ebremner banners above,!274Draft: ISTWCMS-5551: fixing office hours display,!260Feature/istwcms 5668 a5kulkar rename references to publications
...@@ -250,12 +250,14 @@ class UwNodeFieldValue { ...@@ -250,12 +250,14 @@ class UwNodeFieldValue {
// Set the banners as empty in case we do not have any. // Set the banners as empty in case we do not have any.
$banners = []; $banners = [];
// Get the layout builder style based from the node value if ($node->field_uw_media_width) {
// of media width. // Get the layout builder style based from the node value
$layout_builder_style = $layout_style = \Drupal::entityTypeManager()->getStorage('layout_builder_style')->load($node->field_uw_media_width->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. // Get the classes associated with the layout builder style.
$media_width_classes = $layout_builder_style->getClasses(); $media_width_classes = $layout_builder_style->getClasses();
}
// Process banner images. // Process banner images.
foreach ($node->$field_name as $banner_item) { foreach ($node->$field_name as $banner_item) {
...@@ -299,7 +301,7 @@ class UwNodeFieldValue { ...@@ -299,7 +301,7 @@ class UwNodeFieldValue {
$banner['sources'] = $banner['image']['responsive_sources']; $banner['sources'] = $banner['image']['responsive_sources'];
$banner['img_element'] = $banner['image']['img_element']['#uri']; $banner['img_element'] = $banner['image']['img_element']['#uri'];
$banner['alt'] = $banner['image']['alt']; $banner['alt'] = $banner['image']['alt'];
$banner['media_width'] = $media_width_classes; $banner['media_width'] = $media_width_classes ?? NULL;
unset($banner['image']); unset($banner['image']);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment