function FieldConfigEditForm::submitForm
Same name in other branches
- 9 core/modules/field_ui/src/Form/FieldConfigEditForm.php \Drupal\field_ui\Form\FieldConfigEditForm::submitForm()
- 8.9.x core/modules/field_ui/src/Form/FieldConfigEditForm.php \Drupal\field_ui\Form\FieldConfigEditForm::submitForm()
- 11.x core/modules/field_ui/src/Form/FieldConfigEditForm.php \Drupal\field_ui\Form\FieldConfigEditForm::submitForm()
Overrides EntityForm::submitForm
File
-
core/
modules/ field_ui/ src/ Form/ FieldConfigEditForm.php, line 389
Class
- FieldConfigEditForm
- Provides a form for the field settings form.
Namespace
Drupal\field_ui\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$field_storage_form = $this->entityTypeManager
->getFormObject('field_storage_config', $this->operation);
$field_storage_form->setEntity($this->entity
->getFieldStorageDefinition());
$subform_state = SubformState::createForSubform($form['field_storage']['subform'], $form, $form_state, $field_storage_form);
$field_storage_form->submitForm($form['field_storage']['subform'], $subform_state);
try {
$field_storage_form->save($form['field_storage']['subform'], $subform_state);
} catch (EntityStorageException $exception) {
$this->handleEntityStorageException($form_state, $exception);
return;
}
// Handle the default value.
$default_value = [];
if (isset($form['default_value']) && (!isset($form['set_default_value']) || $form_state->getValue('set_default_value'))) {
$items = $this->getTypedData($this->entity, $form['#entity']);
$default_value = $items->defaultValuesFormSubmit($form['default_value'], $form, $form_state);
}
$this->entity
->setDefaultValue($default_value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.