Skip to content

sets alt to 'home' for logo #287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions localgov_microsites_base.theme
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use this we'll need to lock the localgov_microsites_base package in the 3.x localgov_microsites profile branch to prevent issues similar to localgovdrupal/localgov_microsites#494


if ($group instanceof MicrositeGroupInterface) {
if ($element['#field_name'] === 'lgms_main_logo') {
$variables['items'][0]['content']['#item']->alt = t('Home');
}
}
}
Loading