function SearchInterface::searchFormAlter

Same name in other branches
  1. 8.9.x core/modules/search/src/Plugin/SearchInterface.php \Drupal\search\Plugin\SearchInterface::searchFormAlter()
  2. 10 core/modules/search/src/Plugin/SearchInterface.php \Drupal\search\Plugin\SearchInterface::searchFormAlter()
  3. 11.x core/modules/search/src/Plugin/SearchInterface.php \Drupal\search\Plugin\SearchInterface::searchFormAlter()

Alters the search form when being built for a given plugin.

The core search module only invokes this method on active module plugins when building a form for them in \Drupal\search\Form\SearchPageForm::buildForm(). A plugin implementing this will also need to implement the buildSearchUrlQuery() method.

Parameters

array $form: Nested array of form elements that comprise the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. The arguments that \Drupal::formBuilder()->getForm() was originally called with are available in the array $form_state->getBuildInfo()['args'].

See also

SearchInterface::buildSearchUrlQuery()

1 method overrides SearchInterface::searchFormAlter()
SearchPluginBase::searchFormAlter in core/modules/search/src/Plugin/SearchPluginBase.php
Alters the search form when being built for a given plugin.

File

core/modules/search/src/Plugin/SearchInterface.php, line 125

Class

SearchInterface
Defines a common interface for all SearchPlugin objects.

Namespace

Drupal\search\Plugin

Code

public function searchFormAlter(array &$form, FormStateInterface $form_state);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.