Returns the bundle label for a given entity type.
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.
string The bundle label.
protected function getBundleLabel(EntityTypeInterface $entity_type) {
if ($entity_type
->getBundleLabel()) {
return $entity_type
->getBundleLabel();
}
if ($entity_type
->getBundleEntityType()) {
return \Drupal::entityTypeManager()
->getDefinition($entity_type
->getBundleEntityType())
->getLabel();
}
return $this
->t('@label type', [
'@label' => $entity_type
->getLabel(),
]);
}