I have found that Rules variables are unavailable in custom templates. For example, I have defined 2 variables in my Rules component settings - a type User and a type Text variable. I programmatically invoke the Rules component like this:

rules_invoke_component('rules_partner_is_approved', $account, 'A text variable I have defined in my Rules component settings');

That works perfectly when I use the Rules UI to access the variables in various textareas. However, when using a template, $account and the custom text variable never reach the theming layer. I found that Mimemail stores the RulesState $state object in $message['params']['context'] when it is available (this is where the Rules variables can be found). So I have solved this by modifying function mimemail_prepare_message($message) to pass $message['params']['context'] as $variables['context'] to preprocess function(s). I found that $variables['context'] was always an empty array, so I am putting it there. Patch is attached. Needs review and testing.

Comments

Nick Robillard created an issue. See original summary.

Nick Robillard’s picture

cimo75’s picture

Hallo thing seems to hav echanged with the latest --dev, could you reformulate this for the new version? Both tokens and variables that are created during rules'action and conditions are not available at the theme ayer in the templates.
tx
Simone

sgabe’s picture

Status: Needs review » Closed (duplicate)

This issue seems to be a duplicate of #1568680: Use $message for themeing.