field_test_entity_info

Versions
mediamosa-21
field_test_entity_info()

Implements hook_entity_info().

▾ 3 functions call field_test_entity_info()

field_test_create_bundle in modules/field/tests/field_test.entity.inc
Creates a new bundle for test_entity entities.
field_test_delete_bundle in modules/field/tests/field_test.entity.inc
Deletes a bundle for test_entity objects.
field_test_rename_bundle in modules/field/tests/field_test.entity.inc
Renames a bundle for test_entity entities.

Code

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

<?php
function field_test_entity_info() {
  $bundles = variable_get('field_test_bundles', array('test_bundle' => array('label' => 'Test Bundle')));
  $test_entity_modes = array(
    'full' => array(
      'label' => t('Full object'),
    ),
    'teaser' => array(
      'label' => t('Teaser'),
    ),
  );

  return array(
    'test_entity' => array(
      'name' => t('Test Entity'),
      'object keys' => array(
        'id' => 'ftid',
        'revision' => 'ftvid',
        'bundle' => 'fttype',
      ),
      'cacheable' => FALSE,
      'bundles' => $bundles,
      'fieldable' => TRUE,
      'view modes' => $test_entity_modes,
    ),
    // This entity type doesn't get form handling for now...
    'test_cacheable_entity' => array(
      'name' => t('Test Entity, cacheable'),
      'object keys' => array(
        'id' => 'ftid',
        'revision' => 'ftvid',
        'bundle' => 'fttype',
      ),
      'fieldable' => TRUE,
      'cacheable' => TRUE,
      'bundles' => $bundles,
      'view modes' => $test_entity_modes,
    ),
  );
}
?>