drupal 7 rules module
TRANSCRIPT
Drupal Rules
The Rules module allows site administrators to define conditionally executed actions based on occurring events (known as reactive or ECA rules). It's a replacement with more features for the trigger module in core and the successor of the Drupal 5 workflow-ng module.
What is Rules
Rules features
Uses Token
Loops & Lists
Nice debug mode
Components
Scheduler
Rule structure
Condition in which cases it should react
Action - what should happen?
Events system events(s) to which one(s) rules will react
Rules Components
Reusable part of Rules
Condition set (OR/AND), action set, rule, rule set
Components evaluation can be scheduled
Can be imported
Can executed (good for debugging)
Rules Scheduler
Rules Scheduler needs components you can only schedule prepared components
Components can be scheduled as actions, for example from reaction rules
The evaluation time for scheduled tasks is set with strtotime(), which means that you can use highly flexible expressions
You can also use data selection, combined with offsets if you want to
Every scheduled task should have a unique task ID, or it will replace existing tasks
Scheduled tasks are displayed under the Schedule tab on the Rules admin pages
You can delete tasks manually if you want to
You can schedule tasks manually, without the need of reaction rules
It is sometimes useful to execute rule components manually, to see that the scheduled tasks will work as expected
Best practice
Make use of tags
Use components to organize your rules
Export your rules to feature modules using Features
Keep your rules simple
Debugging
Rules provides a very useful debugging system. This allows us to follow all the steps of a rule configuration as it's being executed.
RULES API
Events
hook_rules_event_info()
rules_invoke_event()
Actions
- hook_rules_action_info()
- Implement function [action_name](): function arguments match parameters + $settings; returns array of parameter;
Conditions
- hook_rules_condition_info()
- Implement function [condition_name](): function arguments match parameters + $settings; returns only boolean value; cant provide variables; cannot save parameters;
Other Rules API hooks
hook_rules_data_info()
hook_rules_plugin_info()
hook_rules_[action|event...]_info_alter()
hook_default_rules_configuration()
hook_rules_data_process_info()
...
Useful modules
Rules link
Flag
VBO
Rules Bonus Pack
Content access
Commerce?
...