You are here

public function ExampleFormEventSubscribers::alterWidgetStringTextField in Hook Event Dispatcher 8

Alter widget string text field.

Parameters

\Drupal\hook_event_dispatcher\Event\Form\WidgetTypeFormAlterEvent $event: The event.

File

src/Example/ExampleFormEventSubscribers.php, line 84

Class

ExampleFormEventSubscribers
Class ExampleFormEventSubscribers.

Namespace

Drupal\hook_event_dispatcher\Example

Code

public function alterWidgetStringTextField(WidgetTypeFormAlterEvent $event) {
  $element =& $event
    ->getElement();

  // Do something cool.
  $element['special_label'] = [
    'type' => 'label',
    'label' => 'Extra special label',
  ];
}