function field_info_bundles

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.