You are here

function fc_entityreference_incomplete_process in Field Complete 7

1 string reference to 'fc_entityreference_incomplete_process'
entityreference.inc in plugins/fields/entityreference.inc

File

plugins/fields/entityreference.inc, line 41

Code

function fc_entityreference_incomplete_process($parent, $function, $cardinality, $items, $instance, $field) {
  $check_entities = !empty($instance['settings']['fc']['fc_check_entities']);
  $entity_type = $field['settings']['target_type'];
  $incomplete = new fcIncomplete($instance['field_name'], $parent, $entity_type);
  $completed = array();
  if ($check_entities) {
    foreach ($items as $item) {

      // Loads each entity to find out whether it is complete
      $entities = entity_load($entity_type, array(
        $item['target_id'],
      ));
      $entity = reset($entities);
      $sub = new fcIncomplete('', $parent, $entity_type, $entity);
      $sub
        ->process();
      $incomplete[] = $sub;
    }
  }
  $incomplete->complete = $cardinality($function, $items, $instance, $field);
  return $incomplete;
}