You are here

protected function ContentEntityForm::getBundleEntity in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::getBundleEntity()
  2. 9 core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::getBundleEntity()

Returns the bundle entity of the entity, or NULL if there is none.

Return value

\Drupal\Core\Entity\EntityInterface|null The bundle entity.

2 calls to ContentEntityForm::getBundleEntity()
BlockContentForm::save in core/modules/block_content/src/BlockContentForm.php
Form submission handler for the 'save' action.
ContentEntityForm::getNewRevisionDefault in core/lib/Drupal/Core/Entity/ContentEntityForm.php
Should new revisions created on default.

File

core/lib/Drupal/Core/Entity/ContentEntityForm.php, line 91

Class

ContentEntityForm
Entity form variant for content entity types.

Namespace

Drupal\Core\Entity

Code

protected function getBundleEntity() {
  if ($bundle_entity_type = $this->entity
    ->getEntityType()
    ->getBundleEntityType()) {
    return $this->entityTypeManager
      ->getStorage($bundle_entity_type)
      ->load($this->entity
      ->bundle());
  }
  return NULL;
}