Created
November 19, 2013 09:44
-
-
Save VeggieMeat/7542847 to your computer and use it in GitHub Desktop.
Determine if a particular action in Drupal 7 Rules 2 is part of any active rule.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$action_name = 'r2d2'; | |
$rules = rules_config_load_multiple(FALSE); | |
foreach ($rules as $rule) { | |
if (get_class($rule) == 'RulesReactionRule') { | |
foreach ($rule->actions() as $action) { | |
if (get_class($action) == 'RulesAction') { | |
if (($action->getElementName() == $action_name) && ($rule->active == 1)) { | |
return 'that was the droid you were looking for'; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment