function RevisionRevertForm::getBundleLabel

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Entity/Form/RevisionRevertForm.php \Drupal\Core\Entity\Form\RevisionRevertForm::getBundleLabel()

Returns the bundle label of an entity.

Parameters

\Drupal\Core\Entity\RevisionableInterface $entity: The entity.

Return value

string|null The bundle label.

1 call to RevisionRevertForm::getBundleLabel()
RevisionRevertForm::submitForm in core/lib/Drupal/Core/Entity/Form/RevisionRevertForm.php
Form submission handler.

File

core/lib/Drupal/Core/Entity/Form/RevisionRevertForm.php, line 247

Class

RevisionRevertForm
Provides a form for reverting an entity revision.

Namespace

Drupal\Core\Entity\Form

Code

protected function getBundleLabel(RevisionableInterface $entity) : ?string {
    $bundleInfo = $this->bundleInformation
        ->getBundleInfo($entity->getEntityTypeId());
    return isset($bundleInfo[$entity->bundle()]['label']) ? (string) $bundleInfo[$entity->bundle()]['label'] : NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.