On the subject of evaluation handlers, it is very simple for a module to define its own evaluation handler. There are two parts to this process:
  1. Inform the Eval API module that you are defining a new evaluation handler by implementing hook_evalapi_handler(). This is simply a function that returns an array with information about the handler.
  2. Define a callback function that will evaluate a node’s evaluation criteria and return a boolean result.
Modules can optionally define as many evaluation handlers as they like. Below is Eval API’s default evaluation handler:
/**
 * Implementation of hook_evalapi_handler().
 *
 * @see _evalapi_default_handler()
 */
function evalapi_evalapi_handler() {
  return array(
    'evalapi' => array(
      'name' => t('Default'),
      'callback' => '_evalapi_default_handler',
    ),
  );
}
Its format is as follows below:
$handler = array(
  'implementing_module_name' => array(
    'name' => t('Some human readable name'),
    'callback' => 'callback_function_for_evaluating_criteria',
  ),
);
Below is Eval API’s default evaluation handler function:
/**
 * Default Eval API handler callback.
 *
 * Calculation is performed by counting the number of records in the
 * array and then getting the sum of all boolean values, effectively AND’ing
 * them together. If the array is empty, we assume there are no rules to check
 * and thusly return TRUE.
 *
 * @param $eval_criteria
 *   A node’s evaluation criteria array.
 * @return
 *   - TRUE if the number of array records equals the sum of all the array values.
 *   - FALSE otherwise.
 * @see evalapi_evalapi_handler()
 */
function _evalapi_default_handler(&$eval_criteria) {
  if (empty($eval_criteria)) {
    return TRUE;
  }

  $all_rules  = array();

  foreach ($eval_criteria as $rules) {
    $all_rules = array_merge($all_rules, $rules);
  }

  if (count($all_rules) == array_sum($all_rules)) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}
It takes a reference to the evaluation criteria array and returns a boolean.
NOTE: It is not required to pass the evaluation criteria as a parameter to the handler function. All that is required of module’s implementing their own evaluation handlers is that a boolean value is returned from the callback function.
It should also be noted that the Eval API does not provide the means for taking action based on a node’s evaluation. It simply provides the mechanism to define the criteria to be evaluated and the method of evaluation. Other module’s are responsible for determining what to do with the evaluated criteria. Since a node’s evaluation criteria is dynamic, it is not stored in the database, but rather in the current user’s session and the node object. Each node that is Eval API enabled will store an array in the user’s session that looks like the following:
$_SESSION['evalapi_eval_value_NID'] => EVALUATED_VALUE;
The property’s value that is attached to the node object follows the same format and will look like the following:
$node->evalapi['evalapi_eval_value_NID'] = EVALUATED_VALUE;
Where NID is this nid of the node being evaluated, and EVALUATED_VALUE is the returned boolean result of the called evaluation handler.