You are here

public static function WidgetBase::getWidgetState 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::getWidgetState()

Retrieves processing information about the widget from $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 field lives in the form.

string $field_name: The field name.

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

Return value

array An array with the following key/value pairs:

  • items_count: The number of widgets to display for the field.
  • array_parents: The location of the field's widgets within the $form structure. This entry is populated at '#after_build' time.

Overrides WidgetBaseInterface::getWidgetState

8 calls to WidgetBase::getWidgetState()
FileWidget::formMultipleElements in core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
Overrides \Drupal\Core\Field\WidgetBase::formMultipleElements().
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.

... See full list

File

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

Class

WidgetBase
Base class for 'Field widget' plugin implementations.

Namespace

Drupal\Core\Field

Code

public static function getWidgetState(array $parents, $field_name, FormStateInterface $form_state) {
  return NestedArray::getValue($form_state
    ->getStorage(), static::getWidgetStateParents($parents, $field_name));
}