function hook_entity_bundle_info_alter

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_info_alter()
  2. 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_info_alter()
  3. 10 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_info_alter()

Alter the bundles for entity types.

Parameters

array $bundles: An array of bundles, keyed first by entity type, then by bundle name.

See also

Drupal\Core\Entity\EntityTypeBundleInfo::getBundleInfo()

hook_entity_bundle_info()

Related topics

3 functions implement hook_entity_bundle_info_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_test_bundle_class_entity_bundle_info_alter in core/modules/system/tests/modules/entity_test_bundle_class/entity_test_bundle_class.module
Implements hook_entity_bundle_info_alter().
entity_test_entity_bundle_info_alter in core/modules/system/tests/modules/entity_test/entity_test.module
Implements hook_entity_bundle_info_alter().
forum_entity_bundle_info_alter in core/modules/forum/forum.module
Implements hook_entity_bundle_info_alter().

File

core/lib/Drupal/Core/Entity/entity.api.php, line 903

Code

function hook_entity_bundle_info_alter(&$bundles) {
    $bundles['user']['user']['label'] = t('Full account');
    // Override the bundle class for the "article" node type in a custom module.
    $bundles['node']['article']['class'] = 'Drupal\\my_module\\Entity\\Article';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.