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'); + } + } +}