function hook_field_is_empty

hook_field_is_empty($item, $field)

Define what constitutes an empty item for a field type.

Parameters

$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

File

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

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!field.api.php/function/hook_field_is_empty/7.x