summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-14 05:16:26 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-14 05:16:26 +0000
commit7cd59c6bc49b9a8608eb07304b265a59fe51e63f (patch)
treeafaef53fac95a4fb0c6db96962d5b966510d7a0e /modules
parent1724844d014cf39b78991fe60f7b20d913e7d090 (diff)
downloadbrdo-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.php19
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.