1 field.crud.inc field_retrieve_schema($field)

Retrieves the schema for a field.

@since 1.26.4 Function added.

Parameters

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

Return value

array: The field schema definition array.

Related topics

File

core/modules/field/field.crud.inc, line 33
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 BACKDROP_ROOT . '/core/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()
  backdrop_alter('field_schema', $schema, $field);
  return $schema;
}