Problem/Motivation

The 'advanced search' link doesn't show at the top of this page: https://www.drupal.org/project/issues/search_api?text=common

The problem is this code:

$is_adv_search = strpos(current_path(), 'project/issues/search') === 0;

in https://git.drupalcode.org/project/project_issue/-/blob/7.x-2.x/project_...

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joachim created an issue. See original summary.

bramdriesen’s picture

I guess the easiest fix would be to just check if the current path matches the path exactly.

$is_adv_search = current_path() === 'project/issues/search';

bramdriesen’s picture

Status: Active » Needs review
bramdriesen’s picture

Status: Needs review » Needs work

It's friday 😅 this won't work

bramdriesen’s picture

Status: Needs work » Needs review

Since the format of the advanced search url is like https://www.drupal.org/project/issues/search/search_api

I guess we can just check for the URL project/issues/search/ with a trailing /

fjgarlin’s picture

Status: Needs review » Needs work

https://www.drupal.org/project/issues/search (global advanced search for all modules) would not match that.

I think we need an or condition, something like this:

$is_adv_search = (
  (current_path() === 'project/issues/search') ||
  (strpos(current_path(), 'project/issues/search/') === 0)
);
fjgarlin’s picture

I tested the above suggestion here https://fjgarlin-drupal.dev.devdrupal.org/project/issues/search and here https://fjgarlin-drupal.dev.devdrupal.org/project/issues/search_api and it seems to work. So it just needs applying to the MR.

joachim’s picture

So:

- /project/issues/search is global advanced search
- project/issues/search/search_api is specific advanced search

and

- project/issues/search_api is plain specific search

Sounds like a regex with a \b at the end will do it.

Fortunately there is no module just called 'search'!

bramdriesen’s picture

Yes, that would solve the issue for both cases

bramdriesen’s picture

Status: Needs work » Needs review

Applied the suggestion.

fjgarlin’s picture

Status: Needs review » Reviewed & tested by the community

My test at 7 has the same code as the MR. Setting it to RTBC.

drumm made their first commit to this issue’s fork.

  • drumm committed 5350f5af on 7.x-2.x authored by BramDriesen
    Issue #3453225: “Advanced search” link doesn’t show if a module’s name...
drumm’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all, this has been deployed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.