Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::getWidgetStateParents()
  2. 9 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::getWidgetStateParents()

Returns the location of processing information within $form_state.

Parameters

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

string $field_name: The field name.

Return value

array The location of processing information within $form_state.

2 calls to WidgetBase::getWidgetStateParents()
WidgetBase::getWidgetState in core/lib/Drupal/Core/Field/WidgetBase.php
Retrieves processing information about the widget from $form_state.
WidgetBase::setWidgetState in core/lib/Drupal/Core/Field/WidgetBase.php
Stores processing information about the widget in $form_state.

File

core/lib/Drupal/Core/Field/WidgetBase.php, line 506

Class

WidgetBase
Base class for 'Field widget' plugin implementations.

Namespace

Drupal\Core\Field

Code

protected static function getWidgetStateParents(array $parents, $field_name) {

  // Field processing data is placed at
  // $form_state->get(['field_storage', '#parents', ...$parents..., '#fields', $field_name]),
  // to avoid clashes between field names and $parents parts.
  return array_merge([
    'field_storage',
    '#parents',
  ], $parents, [
    '#fields',
    $field_name,
  ]);
}