$bundles =
$this->entityTypeBundleInfo->
getBundleInfo($entity_type_id);
// If the entity has bundle entities, the parameter might have been upcasted
// so fetch the raw parameter.
$bundle =
$route_match->
getRawParameter($bundle_parameter);
if ((count($bundles) > 1
) &&
isset($bundles[$bundle])) { return $this->
t('Add @bundle',
['@bundle' =>
$bundles[$bundle]['label'
]]);
} // If the entity supports bundles generally, but only has a single bundle,
// the bundle is probably something like 'Default' so that it preferable to
// use the entity type label.
else { return $this->
addTitle($entity_type_id);
} } /**
* Provides a generic title callback for a single entity.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
* @param \Drupal\Core\Entity\EntityInterface $_entity
* (optional) An entity, passed in directly from the request attributes.
*
* @return string|null
* The title for the entity view page, if an entity was found.
*/