public function ExampleFormEventSubscribers::alterWidgetForm in Hook Event Dispatcher 8
Alter widget form.
Parameters
\Drupal\hook_event_dispatcher\Event\Form\WidgetFormAlterEvent $event: The event.
File
- src/
Example/ ExampleFormEventSubscribers.php, line 70
Class
- ExampleFormEventSubscribers
- Class ExampleFormEventSubscribers.
Namespace
Drupal\hook_event_dispatcher\ExampleCode
public function alterWidgetForm(WidgetFormAlterEvent $event) {
$element =& $event
->getElement();
$element['extra_field'] = [
'#type' => 'textfield',
'#title' => 'I am an extra field!',
];
}