You are here

function faqfield_field_is_empty in FAQ Field 7

Implements hook_field_is_empty().

Here we test whether the submitted values are empty. Whether they are default values will be tested by hook_field_presave().

File

./faqfield.module, line 631
FAQ Field Provides a field for frequently asked questions.

Code

function faqfield_field_is_empty($item, $field) {
  $answer_value = is_array($item['answer']) ? $item['answer']['value'] : $item['answer'];

  // Return TRUE only if both are empty.
  if (empty($item['question']) && empty($answer_value)) {
    return TRUE;
  }
  return FALSE;
}