You are here

public function WidgetFormAlterEvent::__construct in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/field_event_dispatcher/src/Event/Field/WidgetFormAlterEvent.php \Drupal\field_event_dispatcher\Event\Field\WidgetFormAlterEvent::__construct()

WidgetFormAlterEvent constructor.

Parameters

array $element: The field widget form element as constructed by hook_field_widget_form().

\Drupal\Core\Form\FormStateInterface $formState: The current state of the form.

array $context: An associative array containing the following key-value pairs:

  • form: The form structure to which widgets are being attached. This may be a full form structure, or a sub-element of a larger form.
  • widget: The widget plugin instance.
  • items: The field values, as a \Drupal\Core\Field\FieldItemListInterface object.
  • delta: The order of this item in the array of subelements (0, 1, etc).
  • default: A boolean indicating whether the form is being shown as a dummy form to set default values.

File

modules/field_event_dispatcher/src/Event/Field/WidgetFormAlterEvent.php, line 52

Class

WidgetFormAlterEvent
Class WidgetFormAlterEvent.

Namespace

Drupal\field_event_dispatcher\Event\Field

Code

public function __construct(array &$element, FormStateInterface $formState, array $context) {
  $this->element =& $element;
  $this->formState = $formState;
  $this->context = $context;
}