We are running a multilingual site and the pathprocessor which Search API Page implements is a bit too aggressive.

src/PathProcessor/PathProcessorSearchApiPage::processOutbound(.....) checks if we are on a search api page, this is true in our case and we also have language as an option - all systems go according to the function. This leads the processor to think that the url should be changed so $node->url() returns "/path/to/search" instead of "/node/123".

How to reproduce:
1. Run latest version (not present in the previous alpha-release)
2. Call $node->url() while browsing a search-page.

Using \Drupal\Core\Url::fromRoute('entity.node.canonical', ['node' => $node->id()]) returns correct url.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jseffel created an issue. See original summary.

gun_dose’s picture

I have the same issue and this is patch to fix it.

dietr_ch’s picture

Status: Active » Reviewed & tested by the community
StryKaizer’s picture

Priority: Normal » Major

Pushing priority since this kinda breaks the search ;)
Had the same issue, patch fixes issue.

  • borisson_ committed f2a233c on 8.x-1.x authored by gun_dose
    Issue #3061398 by gun_dose: Entity:url() returns wrong url on search api...
borisson_’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed, does this require a new release?

StryKaizer’s picture

Prolly yes

Spokje’s picture

@borisson_ Absolutely yes.

This is one of those things a site-owner would rarely notice (who uses the front-end facing search pages on his/her own site...), so it can go unnoticed for quite a while. Until, of course, the 27th user complaint comes in and you go and look, because you can't really blame it on user error any more after so many complaints...

Status: Fixed » Closed (fixed)

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