function field_test_create_bundle

7.x field_test.entity.inc field_test_create_bundle($bundle, $text = NULL)

Creates a new bundle for test_entity entities.

Parameters

$bundle: The machine-readable name of the bundle.

$text: The human-readable name of the bundle. If none is provided, the machine name will be used.

7 calls to field_test_create_bundle()
EntityFieldQueryTestCase::setUp in drupal-7.x/modules/simpletest/tests/entity_query.test
Sets up a Drupal site for running functional and integration tests.
FieldAttachOtherTestCase::testFieldAttachPrepareViewMultiple in drupal-7.x/modules/field/tests/field.test
Tests the 'multiple entity' behavior of field_attach_prepare_view().
FieldAttachStorageTestCase::testFieldAttachCreateRenameBundle in drupal-7.x/modules/field/tests/field.test
Test field_attach_create_bundle() and field_attach_rename_bundle().
FieldAttachStorageTestCase::testFieldAttachDeleteBundle in drupal-7.x/modules/field/tests/field.test
Test field_attach_delete_bundle().
FieldAttachStorageTestCase::testFieldAttachLoadMultiple in drupal-7.x/modules/field/tests/field.test
Test the 'multiple' load feature.

... See full list

File

drupal-7.x/modules/field/tests/field_test.entity.inc, line 165
Defines an entity type.

Code

function field_test_create_bundle($bundle, $text = NULL) {
  $bundles = variable_get('field_test_bundles', array('test_bundle' => array('label' => 'Test Bundle')));
  $bundles += array($bundle => array('label' => $text ? $text : $bundle));
  variable_set('field_test_bundles', $bundles);

  $info = field_test_entity_info();
  foreach ($info as $type => $type_info) {
    field_attach_create_bundle($type, $bundle);
  }
}