You are here

function _entityform_rules_all_pass in Entityform 7

Determines if Rules invoked by entityform_invoke_rules passes.

Parameters

array $rule_returns:

Return value

boolean

2 calls to _entityform_rules_all_pass()
entityform_edit_form_validate in ./entityform.admin.inc
Form API validate callback for the entityform form
entityform_form_wrapper in ./entityform.admin.inc
Form callback wrapper: create or edit a entityform.

File

./entityform.module, line 1530
Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface

Code

function _entityform_rules_all_pass($rule_returns) {
  $pass = FALSE;
  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;
}