You are here

function tablefield_field_is_empty in TableField 7

Same name and namespace in other branches
  1. 7.3 tablefield.module \tablefield_field_is_empty()
  2. 7.2 tablefield.module \tablefield_field_is_empty()

Implementation of hook_field_is_empty().

1 call to tablefield_field_is_empty()
tablefield_field_validate in ./tablefield.module
Implements hook_field_validate().

File

./tablefield.module, line 130
This module provides a set of fields that can be used to store tabular data with a node. The implementation uses a custom CCK widget.

Code

function tablefield_field_is_empty($item, $field) {

  // @todo, is this the best way to mark the default value form?
  // if we don't, it won't save the number of rows/cols
  // Allow the system settings form to have an emtpy table
  $arg0 = arg(0);
  if ($arg0 == 'admin') {
    return FALSE;
  }

  // Remove the preference fields to see if the table cells are all empty
  unset($item['tablefield']['rebuild']);
  unset($item['tablefield']['import']);
  if (!empty($item['tablefield'])) {
    foreach ($item['tablefield'] as $cell) {
      if (!empty($cell)) {
        return FALSE;
      }
    }
  }
  return TRUE;
}