function EntityType::getCountLabel

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

Overrides EntityTypeInterface::getCountLabel

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function getCountLabel($count) {
    if (empty($this->label_count)) {
        return $this->formatPlural($count, '@count @label', '@count @label entities', [
            '@label' => $this->getSingularLabel(),
        ], [
            'context' => 'Entity type label',
        ]);
    }
    $options = [];
    if (isset($this->label_count['context'])) {
        $options['context'] = $this->label_count['context'];
    }
    return $this->formatPlural($count, $this->label_count['singular'], $this->label_count['plural'], [], $options);
}

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