Skip to content

Commit

Permalink
USAGOV-1996: USAGOV-1996 - DataLayer Missing Level 2 on Spanish Scams…
Browse files Browse the repository at this point in the history
… Wizard
  • Loading branch information
Dale Frey committed Oct 28, 2024
1 parent 8dc378f commit 4691346
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
14 changes: 14 additions & 0 deletions web/modules/custom/usagov_wizard/usagov_wizard.module
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,20 @@ function usagov_wizard_preprocess_html(&$variables) {
$variables['wizardTitle'] = $wizard_title;
$variables['wizardTitleUrl'] = $wizard_title_url;
}
else {
$topParent = $taxonomy_term;
while (!empty($topParent->parent)) {
$thisParent = Term::load($topParent->parent->target_id);
if (empty($thisParent)) break;
$topParent = $thisParent;
}
$variables['wizardTitle'] = $topParent->getName();
$variables['wizardTitleUrl'] = \Drupal::service('path_alias.manager')->getAliasByPath('/taxonomy/term/' . $topParent->id());
$langCode = $taxonomy_term->language()->getId();
if ($langCode == 'es') {
$variables['wizardTitleUrl'] = '/' . $langCode . $variables['wizardTitleUrl'];
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
{{ 'Taxonomy_Text_2'|json_encode(constant('JSON_PRETTY_PRINT'))|raw }}: {{ wizardTitle|json_encode(constant('JSON_UNESCAPED_UNICODE') b-or constant('JSON_UNESCAPED_SLASHES') b-or constant('JSON_UNESCAPED_SLASHES'))|raw }},
{% if page_type != 'wizard-start' %}
{{ 'Taxonomy_Text_3'|json_encode(constant('JSON_PRETTY_PRINT'))|raw }}: {{ link.text|json_encode(constant('JSON_UNESCAPED_UNICODE') b-or constant('JSON_UNESCAPED_SLASHES') b-or constant('JSON_UNESCAPED_SLASHES'))|raw }},
{% endif %}
{% endif %}
{% elseif loop.index <= 5 %}
{% set textTag = 'Taxonomy_Text_' ~ titleCounter %}
{% set titleCounter = titleCounter + 1 %}
Expand All @@ -90,10 +90,12 @@
{% set urlCounter = urlCounter + 1 %}
{% endif %}
{% elseif loop.index == 2 %}
{% if wizardTitleUrl == link.url.toString %}
{{ 'Taxonomy_URL_2'|json_encode(constant('JSON_PRETTY_PRINT'))|raw }}: {{ wizardTitleUrl|json_encode(constant('JSON_UNESCAPED_SLASHES'))|raw }},
{% if wizardTitleUrl != link.url.toString %}
{{ 'Taxonomy_URL_3'|json_encode(constant('JSON_PRETTY_PRINT'))|raw }}: {{ link.url.toString|json_encode(constant('JSON_UNESCAPED_SLASHES'))|raw }},
{% endif %}
{% set urlCounter = urlCounter - 1 %}
{% else %}
{{ 'Taxonomy_URL_3'|json_encode(constant('JSON_PRETTY_PRINT'))|raw }}: {{ link.url.toString|json_encode(constant('JSON_UNESCAPED_SLASHES'))|raw }},
{% endif %}
{% elseif loop.index <= 5 %}
{% set urlTag = 'Taxonomy_URL_' ~ urlCounter %}
{% set urlCounter = urlCounter + 1 %}
Expand Down

0 comments on commit 4691346

Please sign in to comment.