function RulesAbstractPlugin::executeByArgs

Overrides RulesPlugin::executeByArgs

File

includes/rules.core.inc, line 1690

Class

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

Code

public function executeByArgs($args = array()) {
    $replacements = array(
        '%label' => $this->label(),
        '@plugin' => $this->itemName,
    );
    rules_log('Executing @plugin %label.', $replacements, RulesLog::INFO, $this, TRUE);
    $this->processSettings();
    // If there is no element info, just pass through the passed arguments.
    // That way we support executing actions without any info at all.
    if ($this->info()) {
        $state = $this->setUpState($args);
        module_invoke_all('rules_config_execute', $this);
        $result = $this->evaluate($state);
        $return = $this->returnVariables($state, $result);
    }
    else {
        rules_log('Unable to execute @plugin %label.', $replacements, RulesLog::ERROR, $this);
    }
    $state->cleanUp();
    rules_log('Finished executing of @plugin %label.', $replacements, RulesLog::INFO, $this, FALSE);
    return $return;
}