function EntityType::getBundleLabel
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::getBundleLabel()
- 8.9.x core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::getBundleLabel()
- 11.x core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::getBundleLabel()
Overrides EntityTypeInterface::getBundleLabel
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityType.php, line 709
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());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.