localgovdrupal / localgov_base

The base theme for LocalGov Drupal websites.
8 stars 15 forks source link

Add the ability to print a token in the breadcrumb wrappers #584

Closed rupertj closed 2 months ago

rupertj commented 2 months ago

I'm fixing up the breadcrumb trail on H&F's moderngov integration. It currently doesn't look great, as the moderngov module uses its own markup, which doesn't match the markup that localgov_base provides. I'd like to fix that by using the real breadcrumb template, but need to be able to insert a token inside the list that moderngov'll replace with the breadcrumbs.

EG, this is what I currently have in H&F's (updated) moderngov template:

      {# Copied from breadcrumb.html.twig and modified #}
      {{ attach_library('localgov_base/breadcrumbs') }}
      <nav class="breadcrumbs" aria-labelledby="system-breadcrumbs">
        <h2 id="system-breadcrumbs" class="visually-hidden">{{ 'Breadcrumbs'|t }}</h2>
        <ol class="breadcrumbs__list">
            <li class="breadcrumbs__item">
                <a class="breadcrumbs__link" href="{{ url('<front>') }}">{{ 'Home'|t}}</a>
            </li>
            {breadcrumb}
        </ol>
      </nav>
      {# End copied from breadcrumb.html.twig #}

If I can get that "{breadcrumb}" token in there in the right place, I can use the real template instead of copying stuff in, plus it'll fix this for everyone else :)