From e0c99adf95038f1342ee2539970f6cd751f1d21c Mon Sep 17 00:00:00 2001 From: Mark Conroy Date: Fri, 8 Nov 2024 12:25:18 +0000 Subject: [PATCH] sets alt to 'home' for logo --- localgov_microsites_base.theme | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/localgov_microsites_base.theme b/localgov_microsites_base.theme index a3cb415..abec0c5 100644 --- a/localgov_microsites_base.theme +++ b/localgov_microsites_base.theme @@ -6,6 +6,8 @@ */ use Drupal\localgov_microsites_group\Entity\MicrositeGroupInterface; +use Drupal\media\Entity\Media; +use Drupal\file\Entity\File; use Drupal\views\ViewExecutable; /** @@ -686,3 +688,19 @@ function localgov_microsites_base_theme_suggestions_page_alter(array &$suggestio } } } + +/** + * Implements hook_preprocess_HOOK(). + */ +function localgov_microsites_base_preprocess_field(&$variables) { + $element = $variables['element']; + + // Load the group by context. See localgov_microsites_group.module. + $group = localgov_microsites_group_get_by_context(); + + if ($group instanceof MicrositeGroupInterface) { + if ($element['#field_name'] === 'lgms_main_logo') { + $variables['items'][0]['content']['#item']->alt = t('Home'); + } + } +}