function field_read_instances


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 field_read_instances($params = array(), $include_additional = array())
cle7 field_read_instances($params = array(), $include_additional = array())
elmsmedia7 field_read_instances($params = array(), $include_additional = array())
icor7 field_read_instances($params = array(), $include_additional = array())
meedjum_blog7 field_read_instances($params = array(), $include_additional = array())
mooc7 field_read_instances($params = array(), $include_additional = array())

Reads in field instances that match an array of conditions.


$param: An array of properties to use in selecting a field instance. Valid keys include any column of the field_config_instance table. If NULL, all instances will be returned.

$include_additional: The default behavior of this function is to not return field instances that have been marked 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 array of instances matching the arguments.

Related topics

17 calls to field_read_instances()
FieldInfo::getBundleInstances in modules/field/
Retrieves the instances for a bundle.
FieldInfo::getInstances in modules/field/
Retrieves all active, non-deleted instances definitions.
field_attach_delete_bundle in modules/field/
Notify field.module the a bundle was deleted.
field_collection_field_collection_from_field_get_children in sites/all/modules/ulmus/field_collection/ctools/relationships/
Get children callback.
field_purge_batch in modules/field/
Purges a batch of deleted Field API data, instances, or fields.

... See full list


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


function field_read_instances($params = array(), $include_additional = array()) {
  $include_inactive = isset($include_additional['include_inactive']) && $include_additional['include_inactive'];
  $include_deleted = isset($include_additional['include_deleted']) && $include_additional['include_deleted'];

  $query = db_select('field_config_instance', 'fci', array('fetch' => PDO::FETCH_ASSOC));
  $query->join('field_config', 'fc', ' = fci.field_id');

  // Turn the conditions into a query.
  foreach ($params as $key => $value) {
    $query->condition('fci.' . $key, $value);
  if (!$include_inactive) {
    $query->condition('', 1)->condition('fc.storage_active', 1);
  if (!$include_deleted) {
    $query->condition('fc.deleted', 0);
    $query->condition('fci.deleted', 0);

  $instances = array();
  $results = $query->execute();

  foreach ($results as $record) {
    // Filter out instances on unknown entity types (for instance because the
    // module exposing them was disabled).
    $entity_info = entity_get_info($record['entity_type']);
    if ($include_inactive || $entity_info) {
      $instance = unserialize($record['data']);
      $instance['id'] = $record['id'];
      $instance['field_id'] = $record['field_id'];
      $instance['field_name'] = $record['field_name'];
      $instance['entity_type'] = $record['entity_type'];
      $instance['bundle'] = $record['bundle'];
      $instance['deleted'] = $record['deleted'];

      module_invoke_all('field_read_instance', $instance);
      $instances[] = $instance;
  return $instances;



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.