Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::getBundleLabel()
- 9 core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::getBundleLabel()
Gets the label for the bundle.
Return value
string The bundle label.
Overrides EntityTypeInterface::getBundleLabel
File
- core/
lib/ Drupal/ Core/ Entity/ EntityType.php, line 684
Class
- EntityType
- Provides an implementation of an entity type and its metadata.
Namespace
Drupal\Core\EntityCode
public function getBundleLabel() {
// If there is no bundle label defined, try to provide some sensible
// fallbacks.
if (!empty($this->bundle_label)) {
return (string) $this->bundle_label;
}
elseif ($bundle_entity_type_id = $this
->getBundleEntityType()) {
return (string) \Drupal::entityTypeManager()
->getDefinition($bundle_entity_type_id)
->getLabel();
}
return (string) new TranslatableMarkup('@type_label bundle', [
'@type_label' => $this
->getLabel(),
], [], $this
->getStringTranslation());
}