You are here

function field_test_field_storage_details_alter in Drupal 7

Implements hook_field_storage_details_alter().

See also

FieldAttachStorageTestCase::testFieldStorageDetailsAlter()

File

modules/field/tests/field_test.storage.inc, line 49
Defines a field storage backend.

Code

function field_test_field_storage_details_alter(&$details, $field) {

  // For testing, storage details are changed only because of the field name.
  if ($field['field_name'] == 'field_test_change_my_details') {
    $columns = array();
    foreach ((array) $field['columns'] as $column_name => $attributes) {
      $columns[$column_name] = $column_name;
    }
    $details['drupal_variables'] = array(
      FIELD_LOAD_CURRENT => array(
        'moon' => $columns,
      ),
      FIELD_LOAD_REVISION => array(
        'mars' => $columns,
      ),
    );
  }
}