diff --git a/core/lib/Drupal/Core/Config/Entity/EntityBundleWithPluralLabelsTrait.php b/core/lib/Drupal/Core/Config/Entity/EntityBundleWithPluralLabelsTrait.php index e5077dcf46..c8e4133ae2 100644 --- a/core/lib/Drupal/Core/Config/Entity/EntityBundleWithPluralLabelsTrait.php +++ b/core/lib/Drupal/Core/Config/Entity/EntityBundleWithPluralLabelsTrait.php @@ -67,7 +67,11 @@ public function getPluralLabel() { * {@inheritdoc} */ public function getCountLabel($count) { - $index = static::getPluralIndex($count); + if (($index = static::getPluralIndex($count)) === -1) { + // If the index cannot be computed, fallback to a single plural variant. + $index = $count > 1 ? 1 : 0; + } + $label_count = empty($this->label_count) ? [] : explode(PluralTranslatableMarkup::DELIMITER, $this->label_count); if (isset($label_count[$index])) { return new FormattableMarkup($label_count[$index], ['@count' => $count]);