1 text.module text_field_is_empty($item, $field)

Implements hook_field_is_empty().

File

core/modules/field/modules/text/text.module, line 219
Defines simple text field types.

Code

function text_field_is_empty($item, $field) {
  if (!isset($item['value']) || $item['value'] === '') {
    if (isset($item['format']) && $item['format'] !== '' && $item['format'] != filter_default_format()) {
      // If this text field has a text format setting, save it regardless of
      // empty value to keep the format. Unless it's the default format.
      return FALSE;
    }
    elseif (!isset($item['summary']) || $item['summary'] === '') {
      // Neither value nor summary nor format are set,
      // no need to save to database.
      return TRUE;
    }
  }
  return FALSE;
}