You are here

protected function FieldConfigDeleteForm::getConfigNamesToDelete in Zircon Profile 8

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

Returns config names to delete for the deletion confirmation form.

Parameters

\Drupal\Core\Config\Entity\ConfigEntityInterface $entity: The entity being deleted.

Return value

string[] A list of configuration names that will be deleted by this form.

Overrides EntityDeleteForm::getConfigNamesToDelete

File

core/modules/field_ui/src/Form/FieldConfigDeleteForm.php, line 74
Contains \Drupal\field_ui\Form\FieldConfigDeleteForm.

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;
}