diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-14 05:16:26 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-14 05:16:26 +0000 |
commit | 7cd59c6bc49b9a8608eb07304b265a59fe51e63f (patch) | |
tree | afaef53fac95a4fb0c6db96962d5b966510d7a0e /modules | |
parent | 1724844d014cf39b78991fe60f7b20d913e7d090 (diff) | |
download | brdo-7cd59c6bc49b9a8608eb07304b265a59fe51e63f.tar.gz brdo-7cd59c6bc49b9a8608eb07304b265a59fe51e63f.tar.bz2 |
#548630 by bjaspan: Document hook_field_is_empty().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/field/field.api.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/field/field.api.php b/modules/field/field.api.php index 6f40c2009..39618ea08 100644 --- a/modules/field/field.api.php +++ b/modules/field/field.api.php @@ -125,6 +125,7 @@ function hook_fieldable_info_alter(&$info) { * @see hook_field_delete(). * @see hook_field_delete_revision(). * @see hook_field_sanitize(). + * @see hook_field_is_empty(). * * The Field Types API also defines two kinds of pluggable handlers: widgets * and formatters, which specify how the field appears in edit forms and in @@ -519,6 +520,24 @@ function hook_field_prepare_translation($obj_type, $object, $field, $instance, $ } /** + * Define what constitutes an empty item for a field type. + * + * @param $item + * An item that may or may not be empty. + * @param $field + * The field to which $item belongs. + * @return + * TRUE if $field's type considers $item not to contain any data; + * FALSE otherwise. + */ +function hook_field_is_empty($item, $field) { + if (empty($item['value']) && (string)$item['value'] !== '0') { + return TRUE; + } + return FALSE; +} + +/** * Expose Field API widget types. * * Widgets are Form API elements with additional processing capabilities. |