From a34fb8cba607d63942c4604030746ef3d3171a06 Mon Sep 17 00:00:00 2001 From: Chris Wachtman Date: Thu, 17 Oct 2024 11:50:56 -0400 Subject: [PATCH] USAGOV-2019-Missing-Breadcrumbs-on-Wizard-Pages: Adjust wizard breadcrumb data to use existing breadcrumb template --- .../custom/usagov_wizard/usagov_wizard.module | 9 ++++++--- .../custom/usagov/templates/breadcrumb.html.twig | 5 +++++ .../wizard_2024/breadcrumb--wizard.html.twig | 12 ------------ 3 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 web/themes/custom/usagov/templates/wizard_2024/breadcrumb--wizard.html.twig diff --git a/web/modules/custom/usagov_wizard/usagov_wizard.module b/web/modules/custom/usagov_wizard/usagov_wizard.module index ad8b59e3d9..355f14d574 100644 --- a/web/modules/custom/usagov_wizard/usagov_wizard.module +++ b/web/modules/custom/usagov_wizard/usagov_wizard.module @@ -385,16 +385,19 @@ function usagov_wizard_preprocess_breadcrumb(&$variables) { if (isset($crumb['uri'])) { $crumb['url'] = Url::fromUri($crumb['uri'])->toString(); } + if (isset($crumb['title'])) { + $crumb['text'] = ($crumb['title']); + } - $variables['breadcrumb']['crumbs'][] = $crumb; + $variables['wizard_breadcrumb'][] = $crumb; } $language = $taxonomy_term->langcode->value; $home = [ - 'title' => $language == 'en' ? 'Home' : 'Página principal', + 'text' => $language == 'en' ? 'Home' : 'Página principal', 'url' => $language == 'en' ? '/' : '/es', ]; if ($crumbs != NULL) { - array_unshift($variables['breadcrumb']['crumbs'], $home); + array_unshift($variables['wizard_breadcrumb'], $home); } } } diff --git a/web/themes/custom/usagov/templates/breadcrumb.html.twig b/web/themes/custom/usagov/templates/breadcrumb.html.twig index 444cc37b56..358ea7b575 100644 --- a/web/themes/custom/usagov/templates/breadcrumb.html.twig +++ b/web/themes/custom/usagov/templates/breadcrumb.html.twig @@ -36,6 +36,11 @@ { 'text': drupal_title() } ] %} {% endif %} + +{% if wizard_breadcrumb %} + {% set breadcrumb = wizard_breadcrumb %} +{% endif %} + {% if breadcrumb %} diff --git a/web/themes/custom/usagov/templates/wizard_2024/breadcrumb--wizard.html.twig b/web/themes/custom/usagov/templates/wizard_2024/breadcrumb--wizard.html.twig deleted file mode 100644 index e472579a12..0000000000 --- a/web/themes/custom/usagov/templates/wizard_2024/breadcrumb--wizard.html.twig +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "breadcrumb.html.twig" %} - -{% block content %} -
    - {% for item in breadcrumb['crumbs'] %} -
  1. - {% if item.url %}{% endif %}{{ item.title }}{% if item.url %}{% endif %} - -
  2. - {% endfor %} -
-{% endblock %}