diff --git a/hdbt.theme b/hdbt.theme index 958ceb281..f814ad381 100644 --- a/hdbt.theme +++ b/hdbt.theme @@ -321,16 +321,14 @@ function _hdbt_preprocess_image_caption(array &$variables, string $entity_type, // Check for image and image caption availability. if ($entity->hasField($image) && $entity->hasField($image_caption)) { $caption_variable = str_replace('field_', '', $image_caption); - $alt = ''; $caption = ''; - // If caption exists, set it as initial variable for the alt text and - // image caption. + // If caption exists, set it as initial variable for the image caption. if (!$entity->{$image_caption}->isEmpty()) { - $alt = $caption = $entity->{$image_caption}->value; + $caption = $entity->{$image_caption}->value; } - // Combine photographer field value with caption and alt text. + // Combine photographer field value with caption. if ( $entity->{$image}->entity?->hasField('field_photographer') && !$entity->{$image}->entity->field_photographer->isEmpty() @@ -347,7 +345,7 @@ function _hdbt_preprocess_image_caption(array &$variables, string $entity_type, // for the caption and photographer. Otherwise, set only photographer as // caption. if (!empty($caption)) { - $alt = $caption = t( + $caption = t( '@caption Photo: @photographer', ['@photographer' => $photographer, '@caption' => $caption], ['context' => 'Image caption and photographer'] @@ -364,16 +362,6 @@ function _hdbt_preprocess_image_caption(array &$variables, string $entity_type, // Set image caption variable to render array for the templates. $variables[$caption_variable] = $caption; - - if ( - !empty($alt) && - $entity->{$image}->entity?->hasField('field_media_image') && - !$entity->{$image}->entity->field_media_image->first()->isEmpty() - ) { - // Set altered_alt_text variable based on modified alt text - // for the responsive image preprocesses. - $entity->{$image}->entity->field_media_image->first()->altered_alt_text = $alt; - } } }