You are here

function conditional_fields_check_empty in Conditional Fields 6

Checks if a submitted field value is empty

1 call to conditional_fields_check_empty()
conditional_fields_node_editing_form_validate in ./conditional_fields.module
Validation for node editing form.

File

./conditional_fields.module, line 817
Content fields and groups visibility based on the values of user defined 'trigger' fields.

Code

function conditional_fields_check_empty($field) {

  // Normal fields
  if (isset($field[0]['value'])) {
    $value = $field[0]['value'];
  }
  elseif (isset($field[0]['nid'])) {
    $value = $field[0]['nid'];
  }
  if (!count($value) || is_string($value) && drupal_strlen(trim($value)) == 0) {
    return TRUE;
  }
  return FALSE;
}