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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RajabNatshah created an issue. See original summary.

Rajab Natshah’s picture

Rajab Natshah’s picture

Assigned: Rajab Natshah » Unassigned
Status: Active » Needs review
Rajab Natshah’s picture

Issue summary: View changes
Rajab Natshah’s picture

Title: Fix <front> route as route name when a selected node had been set as the front page for the site » Fix tour <front> route as route name when a selected node had been set as the front page for the site
Issue summary: View changes
Issue tags: +Tour
Rajab Natshah’s picture

Version: 8.9.x-dev » 9.3.x-dev
vikashsoni’s picture

FileSize
18.46 KB

@RajabNatshah Patch apply successfully for me
Thanks ...

thejimbirch’s picture

Status: Needs review » Needs work
FileSize
1.14 MB

Patch applies cleanly, but I was unable to get the Tour to load on a node set as the home page.

Here are the steps I took to try to validate this. I may be missing something, or misconfiguring.

  • At /admin/config/system/site-information I set the home page to /node/1
  • Using Tour UI, I created a Tour for the route.
  • I verified the Tour did not appear before the patch.
  • I applies the patch
  • I cleared the cache
  • Tour still did not show for the home page node.

Screencapture of attempted validation steps

Rajab Natshah’s picture

Thanks, Jim for reviewing and testing

Using the #2 patch in
#3164237: Fix Varbase Welcome message not showing up after install compilation after adding and enabling moderation sidebar on the homepage

But using

routes:
  - route_name: "<front>"

In the tour.tour.welcome-to-varbase.yml

Not any other routes or aliases

thejimbirch’s picture

I'll try queuing another test using a custom module, rather than Tour UI.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed
Issue tags: -Tour

This extension is being deprecated, see #3336033: [Meta] Tasks to deprecate Tour module. It will be removed from core and moved to a contrib project, #3376099: [11.x] [Meta] Tasks to remove Tour.

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.