function entity_test_entity_bundle_info_alter

Implements hook_entity_bundle_info_alter().

File

drupal/core/modules/system/tests/modules/entity_test/entity_test.module, line 127
Test module for the entity API providing several entity types for testing.

Code

function entity_test_entity_bundle_info_alter(&$bundles) {
  $entity_info = entity_get_info();
  foreach ($bundles as $entity_type => $info) {
    if ($entity_info[$entity_type]['module'] == 'entity_test') {
      $bundles[$entity_type] = Drupal::state()
        ->get($entity_type . '.bundles') ?: array(
        $entity_type => array(
          'label' => 'Entity Test Bundle',
        ),
      );
    }
  }
}