summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/field_test.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-14 14:55:12 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-14 14:55:12 +0000
commita243e821fa8c19f5cdaae5af0495fcccdda70125 (patch)
treebda3f7e669281b2bd2d2d49fdb7a44c296d2d92e /modules/simpletest/tests/field_test.module
parent7a9fc8a33d49badf34b6f41bed978a2aad004745 (diff)
downloadbrdo-a243e821fa8c19f5cdaae5af0495fcccdda70125.tar.gz
brdo-a243e821fa8c19f5cdaae5af0495fcccdda70125.tar.bz2
- Pactch #569224 by bangpound: expose field storage details through field attach.
Diffstat (limited to 'modules/simpletest/tests/field_test.module')
-rw-r--r--modules/simpletest/tests/field_test.module43
1 files changed, 43 insertions, 0 deletions
diff --git a/modules/simpletest/tests/field_test.module b/modules/simpletest/tests/field_test.module
index 6bd73c250..cbd1bc07e 100644
--- a/modules/simpletest/tests/field_test.module
+++ b/modules/simpletest/tests/field_test.module
@@ -667,6 +667,49 @@ function field_test_field_storage_info() {
}
/**
+ * Implement hook_field_storage_details().
+ */
+function field_test_field_storage_details($field, $instance) {
+ $details = array();
+
+ // Add field columns.
+ $columns = array();
+ foreach ((array) $field['columns'] as $column_name => $attributes) {
+ $columns[$column_name] = $column_name;
+ }
+ return array(
+ 'drupal_variables' => array(
+ 'field_test_storage_data[FIELD_LOAD_CURRENT]' => $columns,
+ 'field_test_storage_data[FIELD_LOAD_REVISION]' => $columns,
+ ),
+ );
+}
+
+/**
+ * Implement hook_field_storage_details_alter().
+ *
+ * @see FieldAttachStorageTestCase::testFieldStorageDetailsAlter()
+ */
+function field_test_field_storage_details_alter(&$details, $field, $instance) {
+
+ // 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,
+ ),
+ );
+ }
+}
+
+/**
* Helper function: store or retrieve data from the 'storage backend'.
*/
function _field_test_storage_data($data = NULL) {