class EntityDeleteForm
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Entity/EntityDeleteForm.php \Drupal\Core\Entity\EntityDeleteForm
- 10 core/lib/Drupal/Core/Entity/EntityDeleteForm.php \Drupal\Core\Entity\EntityDeleteForm
- 8.9.x core/lib/Drupal/Core/Entity/EntityDeleteForm.php \Drupal\Core\Entity\EntityDeleteForm
Provides a generic base class for an entity deletion form.
Hierarchy
- class \Drupal\Core\Form\FormBase implements \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm implements \Drupal\Core\Entity\EntityFormInterface extends \Drupal\Core\Form\FormBase
- class \Drupal\Core\Entity\EntityConfirmFormBase implements \Drupal\Core\Form\ConfirmFormInterface extends \Drupal\Core\Entity\EntityForm
- class \Drupal\Core\Entity\EntityDeleteForm uses \Drupal\Core\Entity\EntityDeleteFormTrait extends \Drupal\Core\Entity\EntityConfirmFormBase
- class \Drupal\Core\Entity\EntityConfirmFormBase implements \Drupal\Core\Form\ConfirmFormInterface extends \Drupal\Core\Entity\EntityForm
- class \Drupal\Core\Entity\EntityForm implements \Drupal\Core\Entity\EntityFormInterface extends \Drupal\Core\Form\FormBase
Expanded class hierarchy of EntityDeleteForm
Related topics
14 files declare their use of EntityDeleteForm
- ActionDeleteForm.php in core/
modules/ action/ src/ Form/ ActionDeleteForm.php - BlockContentTypeDeleteForm.php in core/
modules/ block_content/ src/ Form/ BlockContentTypeDeleteForm.php - BlockDeleteForm.php in core/
modules/ block/ src/ Form/ BlockDeleteForm.php - CommentTypeDeleteForm.php in core/
modules/ comment/ src/ Form/ CommentTypeDeleteForm.php - DateFormatDeleteForm.php in core/
modules/ system/ src/ Form/ DateFormatDeleteForm.php
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityDeleteForm.php, line 13
Namespace
Drupal\Core\EntityView source
class EntityDeleteForm extends EntityConfirmFormBase {
use EntityDeleteFormTrait;
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$entity = $this->getEntity();
// Only do dependency processing for configuration entities. Whilst it is
// possible for a configuration entity to be dependent on a content entity,
// these dependencies are soft and content delete permissions are often
// given to more users. This method should not make assumptions that $entity
// is a configuration entity in case we decide to remove the following
// condition.
if (!$entity instanceof ConfigEntityInterface) {
return $form;
}
$this->addDependencyListsToForm($form, $entity->getConfigDependencyKey(), $this->getConfigNamesToDelete($entity), $this->getConfigManager(), $this->entityTypeManager);
return $form;
}
/**
* Gets the configuration manager.
*
* @return \Drupal\Core\Config\ConfigManager
* The configuration manager.
*/
protected function getConfigManager() {
return \Drupal::service('config.manager');
}
/**
* Returns config names to delete for the deletion confirmation form.
*
* @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
* The entity being deleted.
*
* @return string[]
* A list of configuration names that will be deleted by this form.
*/
protected function getConfigNamesToDelete(ConfigEntityInterface $entity) {
return [
$entity->getConfigDependencyName(),
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.