function hook_field_is_empty

Define what constitutes an empty item for a field type.


$item: An item that may or may not be empty.

$field: The field to which $item belongs.

Return value

TRUE if $field's type considers $item not to contain any data; FALSE otherwise.

Related topics

7 functions implement hook_field_is_empty()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

field_test_field_is_empty in drupal/modules/field/tests/
Implements hook_field_is_empty().
file_field_is_empty in drupal/modules/file/
Implements hook_field_is_empty().
image_field_is_empty in drupal/modules/image/
Implements hook_field_is_empty().
list_field_is_empty in drupal/modules/field/modules/list/list.module
Implements hook_field_is_empty().
number_field_is_empty in drupal/modules/field/modules/number/number.module
Implements hook_field_is_empty().

... See full list


drupal/modules/field/field.api.php, line 693
Hooks provided by the Field module.


function hook_field_is_empty($item, $field) {
  if (empty($item['value']) && (string) $item['value'] !== '0') {
    return TRUE;
  return FALSE;