You are here

function entity_test_entity_bundle_info in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_bundle_info()

Implements hook_entity_bundle_info().

1 string reference to 'entity_test_entity_bundle_info'
KernelTestBaseTest::testSetUp in core/modules/simpletest/src/Tests/KernelTestBaseTest.php
Tests expected behavior of setUp().

File

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

Code

function entity_test_entity_bundle_info() {
  $bundles = array();
  $entity_types = \Drupal::entityManager()
    ->getDefinitions();
  foreach ($entity_types as $entity_type_id => $entity_type) {
    if ($entity_type
      ->getProvider() == 'entity_test') {
      $bundles[$entity_type_id] = \Drupal::state()
        ->get($entity_type_id . '.bundles') ?: array(
        $entity_type_id => array(
          'label' => 'Entity Test Bundle',
        ),
      );
    }
  }
  return $bundles;
}