You are here

function fc_field_collection_field_is_complete in Field Complete 7

1 string reference to 'fc_field_collection_field_is_complete'
field_collection.inc in plugins/fields/field_collection.inc

File

plugins/fields/field_collection.inc, line 22

Code

function fc_field_collection_field_is_complete($items, $instance, $field, &$completed = array()) {
  $module = $field['module'];
  $check_entities = !empty($instance['settings']['fc']['fc_check_entities']);
  foreach ($items as $delta => $item) {
    if ($check_entities) {

      // Loads each field_collection to find out whether it is complete
      $field_collection = field_collection_item_revision_load($item['revision_id']);
      if (!is_object($field_collection)) {
        $completed[] = FALSE;
      }
      else {
        $completed[] = $field_collection->fc->complete;
      }
    }
    else {

      // Just do a superficial check of item
      $completed[$delta] = !module_invoke($module, 'field_is_empty', $item, $field);
    }
  }
}