You are here

function field_info_bundles in Drupal 7

Returns information about existing bundles.

Parameters

$entity_type: The type of entity; e.g. 'node' or 'user'.

Return value

An array of bundles for the $entity_type keyed by bundle name, or, if no $entity_type was provided, the array of all existing bundles, keyed by entity type.

Related topics

8 calls to field_info_bundles()
FieldInfo::getInstances in modules/field/field.info.class.inc
Retrieves all active, non-deleted instances definitions.
field_test_menu in modules/field/tests/field_test.module
Implements hook_menu().
field_ui_fields_list in modules/field_ui/field_ui.admin.inc
Menu callback; lists all defined fields for quick reference.
field_ui_field_delete_form_submit in modules/field_ui/field_ui.admin.inc
Form submission handler for field_ui_field_delete_form().
field_ui_field_edit_form in modules/field_ui/field_ui.admin.inc
Form constructor for the field instance settings form.

... See full list

File

modules/field/field.info.inc, line 432
Field Info API, providing information about available fields and field types.

Code

function field_info_bundles($entity_type = NULL) {
  $info = entity_get_info();
  if ($entity_type) {
    return isset($info[$entity_type]['bundles']) ? $info[$entity_type]['bundles'] : array();
  }
  $bundles = array();
  foreach ($info as $type => $entity_info) {
    $bundles[$type] = $entity_info['bundles'];
  }
  return $bundles;
}