You are here

function hook_field_storage_details in Drupal 7

Reveal the internal details about the storage for a field.

For example, an SQL storage module might return the Schema API structure for the table. A key/value storage module might return the server name, authentication credentials, and bin name.

Field storage modules are not obligated to implement this hook. Modules that rely on these details must only use them for read operations.

Parameters

$field: A field structure.

Return value

An array of details.

  • The first dimension is a store type (sql, solr, etc).
  • The second dimension indicates the age of the values in the store FIELD_LOAD_CURRENT or FIELD_LOAD_REVISION.
  • Other dimensions are specific to the field storage module.

See also

hook_field_storage_details_alter()

Related topics

2 functions implement hook_field_storage_details()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

field_sql_storage_field_storage_details in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_details().
field_test_field_storage_details in modules/field/tests/field_test.storage.inc
Implements hook_field_storage_details().
1 invocation of hook_field_storage_details()
FieldInfo::prepareField in modules/field/field.info.class.inc
Prepares a field definition for the current run-time context.

File

modules/field/field.api.php, line 1712
Hooks provided by the Field module.

Code

function hook_field_storage_details($field) {
  $details = array();

  // Add field columns.
  foreach ((array) $field['columns'] as $column_name => $attributes) {
    $real_name = _field_sql_storage_columnname($field['field_name'], $column_name);
    $columns[$column_name] = $real_name;
  }
  return array(
    'sql' => array(
      FIELD_LOAD_CURRENT => array(
        _field_sql_storage_tablename($field) => $columns,
      ),
      FIELD_LOAD_REVISION => array(
        _field_sql_storage_revision_tablename($field) => $columns,
      ),
    ),
  );
}