protected static function WidgetBase::getWidgetStateParents

protected static WidgetBase::getWidgetStateParents(array $parents, $field_name)

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.

File

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

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(array('field_storage', '#parents'), $parents, array('#fields', $field_name));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Field!WidgetBase.php/function/WidgetBase::getWidgetStateParents/8.1.x