You are here

function field_hidden_field_is_empty in Field Hidden 7

Assesses whether a field item is to be considered empty.

Apparantly being called after validation.

Implements hook_field_is_empty().

Parameters

array $item:

array $field:

Return value

boolean

File

./field_hidden.module, line 576
Drupal Field Hidden module

Code

function field_hidden_field_is_empty($item, $field) {
  if (!isset($item['value']) || !strlen($item['value'])) {
    return TRUE;
  }
  switch ($field['type']) {
    case 'field_hidden_integer':
    case 'field_hidden_decimal':
    case 'field_hidden_float':
      if (!$item['value'] && (string) $item['value'] !== '0') {
        return TRUE;
      }
      break;
  }
  return FALSE;
}