function field_read_instance

7.x field_read_instance($entity_type, $field_name, $bundle, $include_additional = array())

Reads a single instance record from the database.

Generally, you should use field_info_instance() instead, as it provides caching and allows other modules the opportunity to append additional formatters, widgets, and other information.


$entity_type: The type of entity to which the field is bound.

$field_name: The field name to read.

$bundle: The bundle to which the field is bound.

array $include_additional: The default behavior of this function is to not return an instance that has been deleted, or whose field is inactive. Setting $include_additional['include_inactive'] or $include_additional['include_deleted'] to TRUE will override this behavior.

Return value

An instance structure, or FALSE.

Related topics

14 calls to field_read_instance()
FieldAttachStorageTestCase::testFieldAttachDeleteBundle in drupal/modules/field/tests/field.test
Test field_attach_delete_bundle().
FieldCrudTestCase::testDeleteField in drupal/modules/field/tests/field.test
Test the deletion of a field.
FieldInstanceCrudTestCase::testDeleteFieldInstance in drupal/modules/field/tests/field.test
Test the deletion of a field instance.
FieldInstanceCrudTestCase::testReadFieldInstance in drupal/modules/field/tests/field.test
Test reading back an instance definition.
FieldInstanceCrudTestCase::testUpdateFieldInstance in drupal/modules/field/tests/field.test
Test the update of a field instance.

... See full list

1 string reference to 'field_read_instance'
field_read_instances in drupal/modules/field/
Reads in field instances that match an array of conditions.


drupal/modules/field/, line 690
Field CRUD API, handling field and field instance creation and deletion.


function field_read_instance($entity_type, $field_name, $bundle, $include_additional = array()) {
  $instances = field_read_instances(array('entity_type' => $entity_type, 'field_name' => $field_name, 'bundle' => $bundle), $include_additional);
  return $instances ? current($instances) : FALSE;