Problem/Motivation

When page contains two instances of search_redirect_block it can lead to missmatch in redirects.

Steps to reproduce

1. Place one search_redirect_block block in header and set redirect_path option to /search
2. Create an overview page with another search redirect block in sidebar, and set redirect_path option to <current>
3. Go to overview page, submit form in header - see that it reloads current overview page instead of redirecting to /search

Proposed resolution

This seems to be related to core issue.
Following this issue I've created a simple form alteration:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function mymodule_form_search_api_fulltext_facet_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form_state->setRequestMethod('POST');
  $form_state->setCached(TRUE);
}

and it solved the problem.

Remaining tasks

Needs triage, decide if proposed "workaround" can be used.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

sandboxpl created an issue. See original summary.

  • Grayle committed 62217b5 on 6.x
    Issue #3222425: Search redirect block - wrong redirect when two blocks...

  • Grayle committed f3bd121 on 5.x
    Issue #3222425: Search redirect block - wrong redirect when two blocks...
Grayle’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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