function BundleEntityDeleteForm::getContentEntityCount
Gets the count of content entities of this form's bundle.
This is handled separately from additional reasons to make it easier for entity types to customize.
Return value
int The number of entities.
File
-
core/
lib/ Drupal/ Core/ Entity/ Form/ BundleEntityDeleteForm.php, line 99
Class
- BundleEntityDeleteForm
- A generic entity delete form for entities which are bundles.
Namespace
Drupal\Core\Entity\FormCode
protected function getContentEntityCount() : int {
$bundle_entity_type = $this->entity
->getEntityType();
$content_entity_type_id = $bundle_entity_type->getBundleOf();
$content_entity_type = $this->entityTypeManager
->getDefinition($content_entity_type_id);
$num_content_entities = $this->entityTypeManager
->getStorage($content_entity_type_id)
->getQuery()
->accessCheck(FALSE)
->condition($content_entity_type->getKey('bundle'), $this->entity
->id())
->count()
->execute();
return $num_content_entities;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.