You are here

public static function WidgetBase::setWidgetState in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::setWidgetState()

Stores processing information about the widget in $form_state.

This method is static so that is can be used in static Form API #callbacks.

Parameters

array $parents: The array of #parents where the widget lives in the form.

string $field_name: The field name.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

array $field_state: The array of data to store. See getWidgetState() for the structure and content of the array.

Overrides WidgetBaseInterface::setWidgetState

5 calls to WidgetBase::setWidgetState()
FileWidget::submit in core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
Form submission handler for upload/remove button of formElement().
WidgetBase::addMoreSubmit in core/lib/Drupal/Core/Field/WidgetBase.php
Submission handler for the "Add another item" button.
WidgetBase::afterBuild in core/lib/Drupal/Core/Field/WidgetBase.php
After-build handler for field elements in a form.
WidgetBase::extractFormValues in core/lib/Drupal/Core/Field/WidgetBase.php
Extracts field values from submitted form values.
WidgetBase::form in core/lib/Drupal/Core/Field/WidgetBase.php
Creates a form element for a field.

File

core/lib/Drupal/Core/Field/WidgetBase.php, line 466
Contains \Drupal\Core\Field\WidgetBase.

Class

WidgetBase
Base class for 'Field widget' plugin implementations.

Namespace

Drupal\Core\Field

Code

public static function setWidgetState(array $parents, $field_name, FormStateInterface $form_state, array $field_state) {
  NestedArray::setValue($form_state
    ->getStorage(), static::getWidgetStateParents($parents, $field_name), $field_state);
}