function FieldConfigDeleteForm::getConfigNamesToDelete

Same name and namespace in other branches
  1. 11.x core/modules/field_ui/src/Form/FieldConfigDeleteForm.php \Drupal\field_ui\Form\FieldConfigDeleteForm::getConfigNamesToDelete()

File

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

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.