You are here

function rules_condition_fc_state in Field Complete 7

1 string reference to 'rules_condition_fc_state'
fc_rules_condition_info in ./fc.rules.inc
Implements hook_rules_condition_info().

File

./fc.rules.inc, line 37
Field Complete - Provides field-based completeness for any entity -rules.

Code

function rules_condition_fc_state(EntityDrupalWrapper $wrapper, $percentage) {

  // Fetch the raw entity
  $entity = $wrapper
    ->value();

  // Fetch/re-calculate the entity's completeness if necessary
  if (empty($entity->fc)) {
    $entity->fc = fcComplete::load($wrapper
      ->type(), $entity);
  }
  return $entity->fc->percentage >= $percentage;
}