#548630 by bjaspan: Document hook_field_is_empty().
parent
1724844d01
commit
7cd59c6bc4
|
@ -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
|
||||
|
@ -518,6 +519,24 @@ function hook_field_delete_revision($obj_type, $object, $field, $instance, $item
|
|||
function hook_field_prepare_translation($obj_type, $object, $field, $instance, $items) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue