You are here

public function RulesAbstractPlugin::evaluate in Rules 7.2

Evaluate the element on a given rules evaluation state.

Overrides RulesPlugin::evaluate

1 call to RulesAbstractPlugin::evaluate()
RulesAbstractPlugin::executeByArgs in includes/rules.core.inc
Execute the configuration by passing arguments in a single array.

File

includes/rules.core.inc, line 1705
Rules base classes and interfaces needed for any rule evaluation.

Class

RulesAbstractPlugin
Defines a common base class for so-called "Abstract Plugins" like actions.

Code

public function evaluate(RulesState $state) {
  $this
    ->processSettings();
  try {

    // Get vars as needed for execute and call it.
    return $this
      ->executeCallback($this
      ->getExecutionArguments($state), $state);
  } catch (RulesEvaluationException $e) {
    rules_log($e->msg, $e->args, $e->severity);
    rules_log('Unable to evaluate %name.', array(
      '%name' => $this
        ->getPluginName(),
    ), RulesLog::WARN, $this);
  } catch (EntityMetadataWrapperException $e) {
    rules_log('Unable to get a data value. Error: !error', array(
      '!error' => $e
        ->getMessage(),
    ), RulesLog::WARN);
    rules_log('Unable to evaluate %name.', array(
      '%name' => $this
        ->getPluginName(),
    ), RulesLog::WARN, $this);
  }
}