field_info_instances

  1. drupal
    1. 8
    2. 7
Versions
8 – 7 field_info_instances($entity_type = NULL, $bundle_name = NULL)

Retrieves information about field instances.

Parameters

$entity_type The entity type for which to return instances.

$bundle_name The bundle name for which to return instances.

Return value

If $entity_type is not set, return all instances keyed by entity type and bundle name. If $entity_type is set, return all instances for that entity type, keyed by bundle name. If $entity_type and $bundle_name are set, return all instances for that bundle.

Related topics

▾ 25 functions call field_info_instances()

CommentFieldsTest::testCommentDefaultFields in modules/comment/comment.test
Tests that the default 'comment_body' field is correctly added.
entity_form_submit_build_entity in modules/entity/entity.module
Helper function for copying submitted values to entity properties for simple entity forms.
FieldAttachStorageTestCase::testFieldAttachLoadMultiple in modules/field/tests/field.test
Test the 'multiple' load feature.
FieldInfoTestCase::testFieldInfo in modules/field/tests/field.test
Test that field types and field definitions are correcly cached.
FieldTranslationsTestCase::testFieldDisplayLanguage in modules/field/tests/field.test
Tests display language logic for translatable fields.
field_attach_delete in modules/field/field.attach.inc
Delete field data for an existing entity. This deletes all revisions of field data for the entity.
field_attach_delete_revision in modules/field/field.attach.inc
Delete field data for a single revision of an existing entity. The passed entity must have a revision id attribute.
field_attach_insert in modules/field/field.attach.inc
Save field data for a new entity.
field_attach_load in modules/field/field.attach.inc
Loads fields for the current revisions of a group of entities.
field_attach_preprocess in modules/field/field.attach.inc
Populate the template variables with the field values available for rendering.
field_attach_update in modules/field/field.attach.inc
Save field data for an existing entity.
field_info_max_weight in modules/field/field.info.inc
Returns the maximum weight of all the components in an entity.
field_language in modules/field/field.multilingual.inc
Returns the display language for the fields attached to the given entity.
field_sql_storage_field_storage_delete in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_delete().
field_test_field_storage_delete in modules/field/tests/field_test.storage.inc
Implements hook_field_storage_delete().
field_ui_display_overview_form in modules/field_ui/field_ui.admin.inc
Menu callback; presents field display settings for a given view mode.
field_ui_existing_field_options in modules/field_ui/field_ui.admin.inc
Return an array of existing field to be added to a bundle.
field_ui_fields_list in modules/field_ui/field_ui.admin.inc
Menu callback; lists all defined fields for quick reference.
field_ui_field_overview_form in modules/field_ui/field_ui.admin.inc
Menu callback; listing of fields for a bundle.
field_ui_inactive_instances in modules/field_ui/field_ui.module
Helper function to identify inactive fields within a bundle.
hook_field_storage_delete in modules/field/field.api.php
Delete all field data for an entity.
locale_field_node_form_submit in modules/locale/locale.module
Form submit handler for node_form().
node_example_uninstall in examples/node_example/node_example.install
Implements hook_uninstall().
user_register_form in modules/user/user.module
Form builder; the user registration form.
_field_invoke_get_instances in modules/field/field.attach.inc
Helper for _field_invoke(): retrieves a list of instances to operate on.

Code

modules/field/field.info.inc, line 687

<?php
function field_info_instances($entity_type = NULL, $bundle_name = NULL) {
  $info = _field_info_collate_fields();
  if (!isset($entity_type)) {
    return $info['instances'];
  }
  if (!isset($bundle_name)) {
    return $info['instances'][$entity_type];
  }
  if (isset($info['instances'][$entity_type][$bundle_name])) {
    return $info['instances'][$entity_type][$bundle_name];
  }
  return array();
}
?>