1

In my code, I am using rules_invoke_component() to invoke a Rules Component.

On that Rules Component, have 2 variables.

  1. Parameter
  2. Provided

enter image description here

I am successfully able to invoke the Rule and send the Parameter Variable to it (In this case it was $node). But I am just confused on how to get the value of the Provided Variable.

enter image description here

Is that possible?

1

From the "Tiny book of Rules":

Invoking components programmatically 

Rules components are handy tools for allowing site builders to customize their own actions and 
conditions. If you are writing a module that allows site builders to set custom conditions (or 
actions), you can let them set these up as Rules components and then evaluate selected components 
programmatically. This works in a way analogous to invoking events, by using 
rules _invoke_component() . 

The first argument is the (machine) name of the component, and any subsequent arguments are 
variables sent to the component. 

// Included somewhere in your custom module. 

$component name = $settings [' rules component name']; 

// Any variables provided from the component are returned from its evaluation. 

$result = rules _invoke_component ( $component_name, $var 1, $var 2 ) ; 

So the last 2 lines in the quote above should answer your question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.