diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-09-26 15:57:39 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-09-26 15:57:39 +0000 |
commit | db09a6178ba423fe2ce85317afaca5c58a5b6887 (patch) | |
tree | 7a23bc57bfb65197a9ac1416d8c989b506e5e05d /modules/simpletest | |
parent | dba2ebb118a25ff6ed9bcc6a59cc42c20d55ad66 (diff) | |
download | brdo-db09a6178ba423fe2ce85317afaca5c58a5b6887.tar.gz brdo-db09a6178ba423fe2ce85317afaca5c58a5b6887.tar.bz2 |
- Patch #367013 by bjaspan, KarenS | yched, Dries: add support for field updates.
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/tests/field_test.module | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/simpletest/tests/field_test.module b/modules/simpletest/tests/field_test.module index a83d8dff3..1f21e5dc4 100644 --- a/modules/simpletest/tests/field_test.module +++ b/modules/simpletest/tests/field_test.module @@ -349,6 +349,8 @@ function field_test_field_info() { 'label' => t('Test Field'), 'settings' => array( 'test_field_setting' => 'dummy test string', + 'changeable' => 'a changeable field setting', + 'unchangeable' => 'an unchangeable field setting', ), 'instance_settings' => array( 'test_instance_setting' => 'dummy test string', @@ -361,6 +363,15 @@ function field_test_field_info() { } /** + * Implement hook_field_update_forbid(). + */ +function field_test_field_update_forbid($field, $prior_field, $has_data) { + if ($field['type'] == 'test_field' && $field['settings']['unchangeable'] != $prior_field['settings']['unchangeable']) { + throw new FieldException("field_test 'unchangeable' setting cannot be changed'"); + } +} + +/** * Implement hook_field_schema(). */ function field_test_field_schema($field) { @@ -634,7 +645,7 @@ function field_test_entity_info_translatable($obj_type = NULL, $translatable = N * * This function is a simple in-memory key-value store with the * distinction that it stores all values for a given key instead of - * just the most recently set value. field_test module hooks call + * just the most recently set value. field_test module hooks call * this function to record their arguments, keyed by hook name. The * unit tests later call this function to verify that the correct * hooks were called and were passed the correct arguments. |