W3cubDocs

/Drupal 8

function hook_entity_bundle_info

hook_entity_bundle_info()

Describe the bundles for entity types.

Return value

array An associative array of all entity bundles, keyed by the entity type name, and then the bundle name, with the following keys:

  • label: The human-readable name of the bundle.
  • uri_callback: The same as the 'uri_callback' key defined for the entity type in the EntityManager, but for the bundle only. When determining the URI of an entity, if a 'uri_callback' is defined for both the entity type and the bundle, the one for the bundle is used.
  • translatable: (optional) A boolean value specifying whether this bundle has translation support enabled. Defaults to FALSE.

See also

entity_get_bundles()

hook_entity_bundle_info_alter()

Related topics

Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 723
Hooks and documentation related to entities.

Code

function hook_entity_bundle_info() {
  $bundles['user']['user']['label'] = t('User');
  return $bundles;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!entity.api.php/function/hook_entity_bundle_info/8.1.x