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

Gets the indefinite singular form of the name of the entity type.

This should return the human-readable name for a single instance of the entity type. For example: "opportunity" (with the plural as "opportunities"), "child" (with the plural as "children"), or "content item" (with the plural as "content items").

Think of it as an "in a full sentence, this is what we call this" label. As a consequence, the English version is lowercase.

Return value

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

Overrides EntityTypeInterface::getSingularLabel

2 calls to EntityType::getSingularLabel()
EntityType::getCountLabel in core/lib/Drupal/Core/Entity/EntityType.php
Gets the label's definite article form for use with a count of entities.
EntityType::getPluralLabel in core/lib/Drupal/Core/Entity/EntityType.php
Gets the indefinite plural form of the name of the entity type.

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function getSingularLabel() {
  if (empty($this->label_singular)) {
    $lowercase_label = mb_strtolower($this
      ->getLabel());
    $this->label_singular = $lowercase_label;
  }
  return $this->label_singular;
}