Retrieves the schema for a field.

Parameters

array $field: The field array to get the schema definition against.

Return value

array The field schema definition array.

Related topics

3 calls to field_retrieve_schema()
field_create_field in modules/field/field.crud.inc
Creates a field.
field_read_fields in modules/field/field.crud.inc
Reads in fields that match an array of conditions.
field_update_field in modules/field/field.crud.inc
Updates a field.

File

modules/field/field.crud.inc, line 31
Field CRUD API, handling field and field instance creation and deletion.

Code

function field_retrieve_schema($field) {

  // Make sure the installation API is available.
  include_once DRUPAL_ROOT . '/includes/install.inc';
  module_load_all_includes('install');
  $schema = (array) module_invoke($field['module'], 'field_schema', $field);
  $schema += array(
    'columns' => array(),
    'indexes' => array(),
    'foreign keys' => array(),
  );

  // Give other modules a chance to alter this definition.
  // @see hook_field_schema_alter()
  drupal_alter('field_schema', $schema, $field);
  return $schema;
}