Fix tour <front> route as route name when a selected node had been set as the front page for the site

Created on 16 August 2020, over 4 years ago
Updated 19 May 2024, 11 months ago

Problem/Motivation

The <front> route name is not been used to match on route name for current route name
when a selected node had been set as the front page for the site

Steps to reproduce

Given that we have a custom tour for the home page
And we used the <front> as the route to show the tour up
When we select a node as the front page like "/node/1" for the homepage
Then the tour icon in the toolbar will not show up
as the entity.node.canonical is been returned by

  // Load all of the items and match on route name.
  $route_match = \Drupal::routeMatch();
  $route_name = $route_match->getRouteName();

Proposed resolution

Check if the current matching path is the front page
and change the route name been passed to the tour Drupal entity query
To mach by route name not the entity.node.canonical by a node which been selected as the front page settings.

We could add

  // Check if the current matching path is the front page.
  if (\Drupal::service('path.matcher')->isFrontPage()) {
    $route_name = '<front>';
   }

As the route is more important than any other route name when the page is the front page.

Remaining tasks

User interface changes

When we configure a tour for the <front> page route
It will show up the icon for the Tour on the front page
even if we had other type of entities or selected entity as the front page.

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

πŸ“Œ Task
Status

Fixed

Version

2.0

Component
TourΒ  β†’

Last updated 3 months ago

Created by

πŸ‡―πŸ‡΄Jordan Rajab Natshah Jordan

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024