function FieldConfigDeleteForm::buildForm
Same name in other branches
- 9 core/modules/field_ui/src/Form/FieldConfigDeleteForm.php \Drupal\field_ui\Form\FieldConfigDeleteForm::buildForm()
- 8.9.x core/modules/field_ui/src/Form/FieldConfigDeleteForm.php \Drupal\field_ui\Form\FieldConfigDeleteForm::buildForm()
- 10 core/modules/field_ui/src/Form/FieldConfigDeleteForm.php \Drupal\field_ui\Form\FieldConfigDeleteForm::buildForm()
Overrides EntityDeleteForm::buildForm
File
-
core/
modules/ field_ui/ src/ Form/ FieldConfigDeleteForm.php, line 38
Class
- FieldConfigDeleteForm
- Provides a form for removing a field from a bundle.
Namespace
Drupal\field_ui\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
// If we are adding the field storage as a dependency to delete, then that
// will list the field as a dependency. That is confusing, so remove it.
// Also remove the entity type and the whole entity deletions details
// element if nothing else is in there.
if (isset($form['entity_deletes']['field_config']['#items']) && isset($form['entity_deletes']['field_config']['#items'][$this->entity
->id()])) {
unset($form['entity_deletes']['field_config']['#items'][$this->entity
->id()]);
if (empty($form['entity_deletes']['field_config']['#items'])) {
unset($form['entity_deletes']['field_config']);
if (!Element::children($form['entity_deletes'])) {
$form['entity_deletes']['#access'] = FALSE;
}
}
}
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.