Skip to content

Commit

Permalink
USAGOV-1996: fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Dale Frey committed Oct 28, 2024
1 parent 4691346 commit 276b246
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions web/modules/custom/usagov_wizard/usagov_wizard.module
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,22 @@ function usagov_wizard_preprocess_html(&$variables) {
$variables['wizardTitleUrl'] = $wizard_title_url;
}
else {
// Lookup the top-most taxonomy parent
$topParent = $taxonomy_term;
while (!empty($topParent->parent)) {
$thisParent = Term::load($topParent->parent->target_id);
if (empty($thisParent)) break;
if (empty($thisParent)) {
break;
}
$topParent = $thisParent;
}

$variables['wizardTitle'] = $topParent->getName();
$variables['wizardTitleUrl'] = \Drupal::service('path_alias.manager')->getAliasByPath('/taxonomy/term/' . $topParent->id());

// Make sure Spanish-paths are prefixed with /es/
$langCode = $taxonomy_term->language()->getId();
if ($langCode == 'es') {
if ($langCode == 'es' && !str_starts_with($variables['wizardTitleUrl'], '/es/')) {
$variables['wizardTitleUrl'] = '/' . $langCode . $variables['wizardTitleUrl'];
}
}
Expand Down

0 comments on commit 276b246

Please sign in to comment.