public function ExampleFormEventSubscribers::alterForm in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 examples/ExampleFormEventSubscribers.php \Drupal\hook_event_dispatcher\ExampleFormEventSubscribers::alterForm()
Alter form.
Parameters
\Drupal\core_event_dispatcher\Event\Form\FormAlterEvent $event: The event.
File
- examples/
ExampleFormEventSubscribers.php, line 30
Class
- ExampleFormEventSubscribers
- Class ExampleFormEventSubscribers.
Namespace
Drupal\hook_event_dispatcherCode
public function alterForm(FormAlterEvent $event) : void {
$form =& $event
->getForm();
$form['extra_markup'] = [
'#markup' => 'This is really cool markup',
];
}