public function SearchPluginBase::searchFormAlter in Drupal 10
Same name and namespace in other branches
- 8 core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::searchFormAlter()
- 9 core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::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'].
Overrides SearchInterface::searchFormAlter
See also
SearchInterface::buildSearchUrlQuery()
File
- core/
modules/ search/ src/ Plugin/ SearchPluginBase.php, line 115
Class
- SearchPluginBase
- Defines a base class for plugins wishing to support search.
Namespace
Drupal\search\PluginCode
public function searchFormAlter(array &$form, FormStateInterface $form_state) {
// Empty default implementation.
}