function WidgetBaseInterface::getWidgetState

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Field/WidgetBaseInterface.php \Drupal\Core\Field\WidgetBaseInterface::getWidgetState()
  2. 10 core/lib/Drupal/Core/Field/WidgetBaseInterface.php \Drupal\Core\Field\WidgetBaseInterface::getWidgetState()
  3. 11.x core/lib/Drupal/Core/Field/WidgetBaseInterface.php \Drupal\Core\Field\WidgetBaseInterface::getWidgetState()

Retrieves processing information about the widget from $form_state.

This method is static so that it 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.
1 method overrides WidgetBaseInterface::getWidgetState()
WidgetBase::getWidgetState in core/lib/Drupal/Core/Field/WidgetBase.php
Retrieves processing information about the widget from $form_state.

File

core/lib/Drupal/Core/Field/WidgetBaseInterface.php, line 88

Class

WidgetBaseInterface
Base interface definition for "Field widget" plugins.

Namespace

Drupal\Core\Field

Code

public static function getWidgetState(array $parents, $field_name, FormStateInterface $form_state);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.