سؤال

How to programmatically retrieve configuration of the specific rule?

I tried

$settings = rules_config_load('RULE_NAME');

It returns very basic info (name, ID etc) and empty "settings" array.

Cant also get it directly from DB .

It is stored in serialized array that can not be fully processed with the unserialize() function

هل كانت مفيدة؟

المحلول

I got the same issue and end up here, here is a solution i found, you need to call actions() on your rule to access settings:

$rule = rules_config_load('RULE_NAME');
foreach ($rule->actions() as $action) {
  $settings[] = $action->settings;
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top