You are here

public function ExampleFormEventSubscribers::alterSearchForm in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x examples/ExampleFormEventSubscribers.php \Drupal\hook_event_dispatcher\ExampleFormEventSubscribers::alterSearchForm()

Alter search form.

Parameters

\Drupal\core_event_dispatcher\Event\Form\FormIdAlterEvent $event: The event.

File

examples/ExampleFormEventSubscribers.php, line 44

Class

ExampleFormEventSubscribers
Class ExampleFormEventSubscribers.

Namespace

Drupal\hook_event_dispatcher

Code

public function alterSearchForm(FormIdAlterEvent $event) : void {
  $form =& $event
    ->getForm();

  // Add placeholder.
  $form['keys']['#attributes']['placeholder'] = 'Search some things';
}