FieldConfigDeleteForm::getConfigNamesToDelete

protected FieldConfigDeleteForm::getConfigNamesToDelete(ConfigEntityInterface $entity)

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 69

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;
}
doc_Drupal
2016-10-29 09:11:01
Comments
Leave a Comment

Please login to continue.