From 22428ab12143ad4b611ac676b6c1964f755ef1bd Mon Sep 17 00:00:00 2001 From: Steve Wirt Date: Thu, 11 Jan 2024 23:26:25 -0500 Subject: [PATCH] VACMS-16827 Fix loading of alt text field definitions. --- .../va_gov_media/src/EventSubscriber/MediaEventSubscriber.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docroot/modules/custom/va_gov_media/src/EventSubscriber/MediaEventSubscriber.php b/docroot/modules/custom/va_gov_media/src/EventSubscriber/MediaEventSubscriber.php index 7f78cdc0a8..aba483d348 100644 --- a/docroot/modules/custom/va_gov_media/src/EventSubscriber/MediaEventSubscriber.php +++ b/docroot/modules/custom/va_gov_media/src/EventSubscriber/MediaEventSubscriber.php @@ -106,11 +106,11 @@ public static function imageFieldWidgetProcess(array $element, FormStateInterfac } $delta = $element['#delta']; - $fieldDefinition = $entity->getFieldDefinition('image'); + $fieldDefinition = $entity->getFieldDefinition($element['#field_name']); $keys = [$element['#entity_type']]; $keys[] = $entity->id() ? $entity->id() : 0; - if (method_exists($fieldDefinition, 'id')) { + if (is_object($fieldDefinition) && method_exists($fieldDefinition, 'id')) { $field_definition_id = str_replace('.', '--', $fieldDefinition->id()); } else {