function _update_7000_field_read_fields

Fetches all of the field definitions from the database.

Warning: Unlike the field_read_fields() API function, this function returns all fields by default, including deleted and inactive fields, unless specified otherwise in the $conditions parameter.

Parameters

$conditions: An array of conditions to limit the select query to.

$key: The name of the field property the return array is indexed by. Using anything else than 'id' might cause incomplete results if the $conditions do not filter out deleted fields.

Return value

An array of fields matching $conditions, keyed by the property specified by the $key parameter.

Related topics

1 call to _update_7000_field_read_fields()
field_sql_storage_update_8000 in drupal/core/modules/field/modules/field_sql_storage/field_sql_storage.install
Changes field language into langcode.

File

drupal/core/modules/field/field.install, line 320
Install, update, and uninstall functions for the Field module.

Code

function _update_7000_field_read_fields(array $conditions = array(), $key = 'id') {
  $fields = array();
  $query = db_select('field_config', 'fc', array(
    'fetch' => PDO::FETCH_ASSOC,
  ))
    ->fields('fc');
  foreach ($conditions as $column => $value) {
    $query
      ->condition($column, $value);
  }
  foreach ($query
    ->execute() as $record) {
    $field = unserialize($record['data']);
    $field['id'] = $record['id'];
    $field['field_name'] = $record['field_name'];
    $field['type'] = $record['type'];
    $field['module'] = $record['module'];
    $field['active'] = $record['active'];
    $field['storage']['type'] = $record['storage_type'];
    $field['storage']['module'] = $record['storage_module'];
    $field['storage']['active'] = $record['storage_active'];
    $field['locked'] = $record['locked'];
    $field['cardinality'] = $record['cardinality'];
    $field['translatable'] = $record['translatable'];
    $field['deleted'] = $record['deleted'];
    $fields[$field[$key]] = $field;
  }
  return $fields;
}