You are here

function _entity_rules_all_pass in Entity Rules 7

Determines if Rules invoked by entityform_invoke_rules passes.

Parameters

array $rule_returns:

Return value

boolean

2 calls to _entity_rules_all_pass()
entity_rules_entity_form_validation in ./entity_rules.module
Validation callback for forms to be validated via Rules.
entity_rules_form_alter in ./entity_rules.module
Implements hook_form_alter().

File

./entity_rules.module, line 669
Module file for the Entity Rules.

Code

function _entity_rules_all_pass($rule_returns) {
  if (empty($rule_returns)) {

    // No Returns so pass
    return TRUE;
  }
  foreach ($rule_returns as $rule_return) {

    // Components that subclass RulesConditionContainer will return a boolean.
    if ($rule_return === FALSE) {

      //First Rule that didn't pass
      return FALSE;
    }

    // Components that subclass RulesActionContainer will array of "Provided" vars
    if (is_array($rule_return)) {

      //This is not a Condition Component

      //The first value should be a returned "Truth Value"
      if (isset($rule_return[0]) && $rule_return[0] == FALSE) {

        //First Rule that didn't pass
        return FALSE;
      }
    }
  }

  //All Rules passed
  return TRUE;
}