You are here

function rb_views_plugin_argument_validate_rules_component::validate_argument in Rules Bonus Pack 7

Overrides views_plugin_argument_validate::validate_argument

File

views/rb_views_plugin_argument_validate_rules_component.inc, line 42
Contains the plugin for validating a Views argument with rule sets.

Class

rb_views_plugin_argument_validate_rules_component
Use a Rules component to validate a contextual filter value ('argument').

Code

function validate_argument($argument) {

  // Run the rule set with the argument value as input.
  $result = rules_invoke_component($this->options['component'], &$this->argument->argument, $this->view->args);

  // Update the argument with the output from the rule set.
  $this->argument->argument = $result[0];
  $this->view->args = $result[1];

  // Return the validation boolean from the rule set.
  return $result[2];
}