You are here

function rb_misc_conditions_evaluate in Rules Bonus Pack 7

Check for access.

1 string reference to 'rb_misc_conditions_evaluate'
rb_misc_condition_get_plugin_info in plugins/access/rb_misc_conditions.inc
Gets plugin information for a single component.

File

plugins/access/rb_misc_conditions.inc, line 112
Plugin to create access plugins from Rules condition components.

Code

function rb_misc_conditions_evaluate($conf, $context) {

  // For evaluating the component make use of the condition rules provides
  // for it, as it loads the component from cache.
  $condition = rules_condition('component_' . $conf['component_name']);

  // In case no component can be loaded, return FALSE to signal that somethis
  // is wrong.
  if (!$condition) {
    return FALSE;
  }

  // Get the name of the parameters required by the component.
  $parameters = $condition
    ->parameterInfo();

  // Get the argument value for each parameter from the context object. (It
  // already contains the parameter names expected by Rules.)
  $arguments = array();
  foreach ($parameters as $name => $parameter) {
    $arguments[$name] = array_shift($context)->data;
  }

  // Evaluate the condition component and return the result.
  return $condition
    ->executeByArgs($arguments);
}