function LayoutBuilderEntityViewDisplay::label

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::label()
  2. 8.9.x core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::label()
  3. 10 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::label()

@todo Move this upstream in https://www.drupal.org/node/2939931.

Overrides EntityBase::label

File

core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php, line 364

Class

LayoutBuilderEntityViewDisplay
Provides an entity view display entity that has a layout.

Namespace

Drupal\layout_builder\Entity

Code

public function label() {
    $bundle_info = \Drupal::service('entity_type.bundle.info')->getBundleInfo($this->getTargetEntityTypeId());
    $bundle_label = $bundle_info[$this->getTargetBundle()]['label'];
    $target_entity_type = $this->entityTypeManager()
        ->getDefinition($this->getTargetEntityTypeId());
    return new TranslatableMarkup('@bundle @label', [
        '@bundle' => $bundle_label,
        '@label' => $target_entity_type->getPluralLabel(),
    ]);
}

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