function RulesPlugin::getExecutionArguments

Gets the right arguments for executing the element.

Throws

RulesEvaluationException If case an argument cannot be retrieved an exception is thrown.

1 call to RulesPlugin::getExecutionArguments()
RulesAbstractPlugin::evaluate in includes/rules.core.inc
Evaluate the element on a given rules evaluation state.

File

includes/rules.core.inc, line 1024

Class

RulesPlugin
Base class for rules plugins.

Code

protected function getExecutionArguments(RulesState $state) {
  $parameters = $this->pluginParameterInfo();
  // If there is language parameter, get its value first so it can be used
  // for getting other translatable values.
  $langcode = NULL;
  if (isset($parameters['language'])) {
    $lang_arg = $this->getArgument('language', $parameters['language'], $state);
    $langcode = $lang_arg instanceof EntityMetadataWrapper ? $lang_arg->value() : $lang_arg;
  }
  // Now get all arguments.
  foreach ($parameters as $name => $info) {
    $args[$name] = $name == 'language' ? $lang_arg : $this->getArgument($name, $info, $state, $langcode);
  }
  // Append the settings and the execution state. Faces will append $this.
  $args['settings'] = $this->settings;
  $args['state'] = $state;
  // Make the wrapped variables for the arguments available in the state.
  $state->currentArguments = $args;
  return rules_unwrap_data($args, $parameters);
}