public function DynamicEntityReferenceOptionsTrait::massageFormValues in Dynamic Entity Reference 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldWidget/DynamicEntityReferenceOptionsTrait.php \Drupal\dynamic_entity_reference\Plugin\Field\FieldWidget\DynamicEntityReferenceOptionsTrait::massageFormValues()
To save both target_type and target_id the option value is split into target_type and target_id.
See also
File
- src/
Plugin/ Field/ FieldWidget/ DynamicEntityReferenceOptionsTrait.php, line 55
Class
- DynamicEntityReferenceOptionsTrait
- The common functionality between DynamicEntityReferenceOptionsWidgets.
Namespace
Drupal\dynamic_entity_reference\Plugin\Field\FieldWidgetCode
public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
foreach ($values as $index => $value) {
list($values[$index]['target_type'], $values[$index]['target_id']) = explode('-', $value['target_id']);
}
return $values;
}