1 field.api.php hook_field_storage_details($field)

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

File

core/modules/field/field.api.php, line 1761
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,
      ),
    ),
  );
}