Toolbar button shows "No tour" even where there is one

Created on 31 October 2024, 4 months ago

Problem/Motivation

Toolbar button shows "No tour" even where there is one available, and infact it opens if you click on the "No tour" button 😅.

Steps to reproduce

Fresh site install with Drupal 10.3.6 & standard profile, enable toolbar, create a simple tour at node.add route, go to /node/add, see the "No tour" in the toolbar and click it.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇮🇹Italy kopeboy Milan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @kopeboy
  • 🇮🇹Italy kopeboy Milan

    I should point out that instead it works as expected if the (core experimental) navigation module is enabled, both with and without the toolbar module enalbed (which should be superflous once navigation is used).

  • This issue is not replicate at my end, it 'll be helpful if more detail steps shared along with screencast.

  • 🇮🇹Italy kopeboy Milan

    I had already given the instructions to reproduce! But here it's an even simpler one:

    1. Install a standard Drupal 10.3.6 site (I used DDEV & drush with ddev drush si
    2. Require & enable this module ddev drush composer require drupal/tour
    3. Check that there is a tour that should show up on Tour edit pages (/admin/config/user-interface/tour/manage/tour_edit)
    4. Go to edit itself or any other tour, eg:/admin/config/user-interface/tour/manage/tours]
    5. Click on the "No tour" button in the toolbar to start the tour

    You can see the same problem on all 3 of the default tours provided, as well as new tour you might create, as I said in #1.

    The problem is with the toolbar module and not with the navigation module. Just enable it and repeat the last 2 steps to see the problem "fixed".

  • 🇺🇸United States smustgrave

    Would have to spin up a 10.3 but not seeing an issue on 11.x

    Are you testing latest 2.0.x branch btw?

  • 🇦🇺Australia kenwest

    Hi, I had a similar issue that was marked as a duplicate of this one. I did some debugging, so I'm copying that here in case it helps shed light on this issue. My issue is that when the route is 'entity.node.edit_form' the 'bundle' parameter is both used and ignored. Looking at the code for Tour 2.0.6 ...

    * The 'entity.node.edit_form' route has a parameter 'node' that is the Node entity being edited
    * tour_page_bottom() discovers this at line 167 of tour.module and sets $params['bundle'] to the node's bundle. This allows the route to be matched so the tour can be added to $page_bottom. This explains why the tour is available when the toolbar button is clicked.
    * On the other hand, tour_toolbar() only looks at the 'node' parameter's id() on line 94, so $no_tips is set TRUE. Then when the button is rendered LazyBuilders::renderTour() sets the text to "No tour".

    My suggestion is that tour_page_bottom() and tour_toolbar() use the same code. Even better, the first function to be called should stash its results so we only need to do one entityQuery('tour'). If this is a helpful way forward I can contribute a patch.

  • 🇺🇸United States smustgrave

    Same question on #7 are you testing on 2.0.x or the tagged release 2.0.6

  • 🇦🇺Australia kenwest

    I was testing 2.0.6 but I've downloaded 2.0.x and the same issue presents.

  • Merge request !89Resolve #3484858 "Toolbar button shows" → (Merged) created by smustgrave
  • 🇺🇸United States smustgrave

    I am seeing the issue but surprised the pipeline is having 0 issues

  • 🇺🇸United States smustgrave

    Can't replicate on 11.0.7

    But I do see on 11.1.x

  • 🇺🇸United States smustgrave

    We can re-open if needed but want to include in the next release, which I'm planning shortly.

  • 🇦🇺Australia kenwest

    I'm continuing to experience this issue with 2.0.7.

    Here is an excerpt from the YML for my tour ...

    id: add_or_edit_a_blog
    label: 'Add or edit a Blog'
    routes:
      -
        route_name: node.add
        route_params:
          node_type: blog
      -
        route_name: entity.node.edit_form
        route_params:
          bundle: blog
    

    For the node.add route, the tour button says "Tour" when I'm adding a Blog, and clicking it starts the add_or_edit_a_blog tour

    For the entity.node.edit_form route, the tour button says "No Tour" when I'm editing a Blog, but clicking it starts the add_or_edit_a_blog tour

  • 🇺🇸United States loopy1492

    We're getting it with routes in search_api on tour 2.0.6 and core 10.3.10

    The routes are like:

    entity.search_api_index.processors
    entity.search_api_index.canonical
    entity.search_api_index.edit_form
    

    You click the "No tour available for this page" and it actually starts the tour.

    What do these routes have in common? They have parameters. Even when I specify a route, the button still displays the wrong label.

    We aren't getting the issue on:

    entity.search_api_index.add_form
    honeypot.config
    block.admin_display
    

    These routes do not have parameters.

  • 🇺🇸United States loopy1492

    Tours working on pages with parameters is a feature request?

  • 🇺🇸United States smustgrave

    From what I can tell that was never part of what it supported. Also based on the description. So least to me seems like a feature request.

  • Merge request !95Resolve #3484858 "Bundle not working" → (Merged) created by smustgrave
  • 🇺🇸United States smustgrave

    Needs more test coverage but a good start.

  • 🇺🇸United States smustgrave

    Wonder if anyone mind testing if this works for them? Then can add coverage for the other params

  • Status changed to Fixed 2 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024