function EntityReferenceAutocompleteWidget::massageFormValues
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget::massageFormValues()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget::massageFormValues()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget::massageFormValues()
Overrides WidgetBase::massageFormValues
1 method overrides EntityReferenceAutocompleteWidget::massageFormValues()
- EntityReferenceAutocompleteTagsWidget::massageFormValues in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldWidget/ EntityReferenceAutocompleteTagsWidget.php - Massages the form values into the format expected for field values.
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldWidget/ EntityReferenceAutocompleteWidget.php, line 140
Class
- EntityReferenceAutocompleteWidget
- Plugin implementation of the 'entity_reference_autocomplete' widget.
Namespace
Drupal\Core\Field\Plugin\Field\FieldWidgetCode
public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
foreach ($values as $key => $value) {
// The entity_autocomplete form element returns an array when an entity
// was "autocreated", so we need to move it up a level.
if (is_array($value['target_id'])) {
unset($values[$key]['target_id']);
$values[$key] += $value['target_id'];
}
}
return $values;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.