protected function EntityTraversal::getBundleLabel in General Data Protection Regulation 8
Same name and namespace in other branches
- 8.2 modules/gdpr_fields/src/EntityTraversal.php \Drupal\gdpr_fields\EntityTraversal::getBundleLabel()
- 3.0.x modules/gdpr_fields/src/EntityTraversal.php \Drupal\gdpr_fields\EntityTraversal::getBundleLabel()
Gets the entity bundle label. Useful for display traversal.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to get the bundle label for.
Return value
string Bundle label
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
2 calls to EntityTraversal::getBundleLabel()
- RightToAccessDisplayTraversal::processEntity in modules/
gdpr_tasks/ src/ Traversal/ RightToAccessDisplayTraversal.php - RightToBeForgottenDisplayTraversal::processEntity in modules/
gdpr_tasks/ src/ Traversal/ RightToBeForgottenDisplayTraversal.php
File
- modules/
gdpr_fields/ src/ EntityTraversal.php, line 293
Class
- EntityTraversal
- Base class for traversing entities.
Namespace
Drupal\gdpr_fieldsCode
protected function getBundleLabel(EntityInterface $entity) {
$entity_definition = $entity
->getEntityType();
$bundle_type = $entity_definition
->getBundleEntityType();
if ($bundle_type) {
$bundle_storage = $this->entityTypeManager
->getStorage($bundle_type);
$bundle_entity = $bundle_storage
->load($entity
->bundle());
$bundle_label = $bundle_entity == NULL ? '' : $bundle_entity
->label();
}
else {
$bundle_label = $entity_definition
->getLabel();
}
return $bundle_label;
}