You are here

protected function RevisionableContentEntityForm::getBundleEntity in Entity API 8.0

Same name and namespace in other branches
  1. 8 src/Form/RevisionableContentEntityForm.php \Drupal\entity\Form\RevisionableContentEntityForm::getBundleEntity()

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

Return value

\Drupal\Core\Entity\EntityInterface|null

Overrides ContentEntityForm::getBundleEntity

3 calls to RevisionableContentEntityForm::getBundleEntity()
RevisionableContentEntityForm::form in src/Form/RevisionableContentEntityForm.php
Gets the actual form array to be built.
RevisionableContentEntityForm::prepareEntity in src/Form/RevisionableContentEntityForm.php
Prepares the entity object before the form is built first.
RevisionableContentEntityForm::save in src/Form/RevisionableContentEntityForm.php
Form submission handler for the 'save' action.

File

src/Form/RevisionableContentEntityForm.php, line 50
Contains \Drupal\entity\Form\RevisionableContentEntityForm.

Class

RevisionableContentEntityForm
Extends the base entity form with revision support in the UI.

Namespace

Drupal\entity\Form

Code

protected function getBundleEntity() {
  if ($bundle_key = $this->entity
    ->getEntityType()
    ->getKey('bundle')) {
    return $this->entity->{$bundle_key}
      ->referencedEntities()[0];
  }
  return NULL;
}