function FieldConfigDeleteForm::getConfigNamesToDelete

Same name in other branches
  1. 9 core/modules/field_ui/src/Form/FieldConfigDeleteForm.php \Drupal\field_ui\Form\FieldConfigDeleteForm::getConfigNamesToDelete()
  2. 8.9.x core/modules/field_ui/src/Form/FieldConfigDeleteForm.php \Drupal\field_ui\Form\FieldConfigDeleteForm::getConfigNamesToDelete()
  3. 11.x core/modules/field_ui/src/Form/FieldConfigDeleteForm.php \Drupal\field_ui\Form\FieldConfigDeleteForm::getConfigNamesToDelete()

Overrides EntityDeleteForm::getConfigNamesToDelete

File

core/modules/field_ui/src/Form/FieldConfigDeleteForm.php, line 80

Class

FieldConfigDeleteForm
Provides a form for removing a field from a bundle.

Namespace

Drupal\field_ui\Form

Code

protected function getConfigNamesToDelete(ConfigEntityInterface $entity) {
    
    /** @var \Drupal\field\FieldStorageConfigInterface $field_storage */
    $field_storage = $entity->getFieldStorageDefinition();
    $config_names = [
        $entity->getConfigDependencyName(),
    ];
    // If there is only one bundle left for this field storage, it will be
    // deleted too, notify the user about dependencies.
    if (count($field_storage->getBundles()) <= 1) {
        $config_names[] = $field_storage->getConfigDependencyName();
    }
    return $config_names;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.