You are here

public function WidgetFormAlterEvent::__construct in Hook Event Dispatcher 8

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

src/Event/Form/WidgetFormAlterEvent.php, line 52

Class

WidgetFormAlterEvent
Class WidgetFormAlterEvent.

Namespace

Drupal\hook_event_dispatcher\Event\Form

Code

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