Skip to content

Breadcrumb behavior not aligned with EC rules #1613

@dhamaris

Description

@dhamaris

Hi, I am using Easy breadcrumb, and i was trying to remove the breadcrumb from the home page:

Image

I set it as checked to be aligned with the behavior of official EC website, see https://commission.europa.eu/index_en
But it still showed, bizarrely, the name of the page as plain text:

Image

As it was not working I looked into the code and I found this in PageHeaderBlock.php, inside oe_theme_helper module:

protected function addBreadcrumbSegments(array $build, $title = ''): array {
   $breadcrumb = $this->breadcrumbBuilder->build($this->currentRouteMatch);
   // Add segments to the breadcrumb key.
   /** @var \Drupal\Core\Link $link */
   foreach ($breadcrumb->getLinks() as $link) {
     $build['#breadcrumb'][] = [
       'href' => $link->getUrl(),
       'label' => $link->getText(),
     ];
   }
   // Add the title to the segments only if it's not empty.
   if (!empty($title)) {
     $build['#breadcrumb'][] = [
       'label' => $title,
     ];
   }
   // Make sure that the cache metadata from the breadcrumb is not lost.
   CacheableMetadata::createFromObject($breadcrumb)->applyTo($build);
   return $build;
 }

Where the "Add the title to the segments only if it's not empty." is responsible for the odd behavior in my front page.
Do you know if this could be fixed?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions