Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::getCollectionLabel()
  2. 9 core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::getCollectionLabel()

Gets the uppercase plural form of the name of the entity type.

This should return a human-readable version of the name that can refer to all the entities of the given type, collectively. An example usage of this is the page title of a page devoted to a collection of entities such as "Workflows" (instead of "Workflow entities").

Return value

string|\Drupal\Core\StringTranslation\TranslatableMarkup The collection label.

Overrides EntityTypeInterface::getCollectionLabel

File

core/lib/Drupal/Core/Entity/EntityType.php, line 756

Class

EntityType
Provides an implementation of an entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function getCollectionLabel() {
  if (empty($this->label_collection)) {
    $label = $this
      ->getLabel();
    $this->label_collection = new TranslatableMarkup('@label entities', [
      '@label' => $label,
    ], [], $this
      ->getStringTranslation());
  }
  return $this->label_collection;
}