You are here

public function LayoutBuilderEntityViewDisplay::label in Drupal 9

Same name and namespace in other branches
  1. 8 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 350

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(),
  ]);
}