protected function ExtraFieldTypePluginBase::getPluginFormStateValue in Entity Extra Field 2.0.x
Same name and namespace in other branches
- 8 src/ExtraFieldTypePluginBase.php \Drupal\entity_extra_field\ExtraFieldTypePluginBase::getPluginFormStateValue()
Get plugin form state value.
Parameters
string|array $key: The element key.
\Drupal\Core\Form\FormStateInterface $form_state: The form state instance.
mixed $default: The default value if nothing is found.
Return value
mixed The form value; otherwise FALSE if the value can't be found.
3 calls to ExtraFieldTypePluginBase::getPluginFormStateValue()
- ExtraFieldBlockPlugin::buildConfigurationForm in src/
Plugin/ ExtraFieldType/ ExtraFieldBlockPlugin.php - Form constructor.
- ExtraFieldTokenPlugin::buildConfigurationForm in src/
Plugin/ ExtraFieldType/ ExtraFieldTokenPlugin.php - Form constructor.
- ExtraFieldViewsPlugin::buildConfigurationForm in src/
Plugin/ ExtraFieldType/ ExtraFieldViewsPlugin.php - Form constructor.
File
- src/
ExtraFieldTypePluginBase.php, line 397
Class
- ExtraFieldTypePluginBase
- Define extra field type plugin base.
Namespace
Drupal\entity_extra_fieldCode
protected function getPluginFormStateValue($key, FormStateInterface $form_state, $default = NULL) {
$key = !is_array($key) ? [
$key,
] : $key;
$inputs = [
$form_state
->cleanValues()
->getValues(),
$this
->getConfiguration(),
];
foreach ($inputs as $input) {
$value = NestedArray::getValue($input, $key, $key_exists);
if (!isset($value) && !$key_exists) {
continue;
}
return $value;
}
return $default;
}