field_test_create_bundle

Versions
7
field_test_create_bundle($bundle, $text = NULL)

Creates a new bundle for test_entity objects.

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.

Code

modules/field/tests/field_test.entity.inc, line 63

<?php
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);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.