SlideShare a Scribd company logo
1 of 20
Rules
Overview, use cases, API

                 Artem Berdishev
                  skype: berdishev
            berdart@amgrade.com
What is Rules?
• Module for developers
• Custom code replaced by some
  configuration
• Interaction between different modules




                                          2
Rules features
•   Token and Entity Token
•   Loops & Lists
•   Nice debug mode
•   Components
•   Scheduler




                               3
Rule architecture
• Events – system event(s) to which one(s)
 rule will react




• Conditions

• Actions

                                             4
Rule architecture
• Events

• Conditions – in which cases it should
 react?




• Actions

                                          5
Rule architecture
• Events

• Conditions

• Actions – what should happen?



                                  6
Components
• This is reusable part of rules
• Use them in creation rules
• Condition set (OR/AND), Action
  set, Rules set
• Components’ evaluation can be
  scheduled (module Rules Scheduler)


                                       7
Useful modules
•   Rules links
•   Flag
•   Views Bulk Operations
•   Message
•   Rules Bonus Pack
•   Content access
•   …..
                             8
Some small examples
• On node creation/saving change URL alias
  pathauto
• Notify admin (moderator, author) about
  content posting notification
• Notify user (author) about new comments
  for node comment_notify
• Custom breadcrumbs for node types
  custom_breadcrumb
• …
                                             9
Big example - Workflow
• Users can add content (status = waiting
  for approval). It’s not published
• The notification will be sent to
  administrator
• He could change status to Approved or
  Declined (+ notification to the author)
• If Approved – author can
  publish/unpublish content

                                            10
Scheduled publishing
• Field for setting publishing (unpublishing)
  date
• Components for (un-)publishing and
  logging
• Rule for
  – reaction on changing date field
  – scheduling the component evaluation

                Scheduler
                                                11
RULES DEMO



             12
Best practices
• Make use of tags
• Use components to organize your rules
• Export your rules to feature modules using
  Features
• Keep your rules simple




                                               13
RULES API



            14
Event API
• hook_rules_event_info()
  – array keyed by event name;
  – options: title, group, variables etc;
• rules_invoke_event()
  – call this function with event name as
    argument to trigger the event
  – for example, in any hook function



                                            15
Action API
• hook_rules_action_info()
  – array – action name (prefixed with module name) as
    key;
  – options:
    label, group, parameter, provides, callbacks, etc.
• Implement function [action_name]()
  – function arguments match parameters + $settings;
  – returns array of parameter or/and provides with their
    name as key;



                                                            16
Condition API
• hook_rules_condition_info()
  – array – condition name (prefixed by module name) as
    key;
  – options: label, parameters, group etc. (same as action)
• Implement function [condition_name]()
  –   function arguments match parameters + $settings;
  –   should return boolean value;
  –   can't provide variables;
  –   cannot save parameters.


                                                              17
Rules API
•   hook_rules_data_info()
•   hook_rules_plugin_info()
•   hook_rules_evaluator_info()
•   hook_rules_data_processor_info()
•   hook_rules_[action|event|…]_info_alter()
•   hook_default_rules_configuration()
•   …..


                                               18
Resources
• The Rules module page on d.o.
 http://drupal.org/project/rules

• The Rules way of life (London 2011)
 http://london2011.drupal.org/conference/sessions/rules-way-life

• Screencast by Johan Falk (Itangalo)
 http://dev.nodeone.se/en/learn-the-rules-framework

• Demo sandbox on d.o.
 http://drupal.org/sandbox/BerdArt/1434760




                                                                   19
Question?
         Artem Berdishev
          skype: berdishev
    berdart@amgrade.com

More Related Content

Similar to Rules

Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Oscar Merida
 
Puppet camp london nov 2014 slides (1)
Puppet camp london nov 2014   slides (1)Puppet camp london nov 2014   slides (1)
Puppet camp london nov 2014 slides (1)Puppet
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS DrupalMumbai
 
Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501Tjarda Peelen
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
Hadoop Eagle - Real Time Monitoring Framework for eBay Hadoop
Hadoop Eagle - Real Time Monitoring Framework for eBay HadoopHadoop Eagle - Real Time Monitoring Framework for eBay Hadoop
Hadoop Eagle - Real Time Monitoring Framework for eBay HadoopDataWorks Summit
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSGunnar Hillert
 
Mcknight well built extensions
Mcknight well built extensionsMcknight well built extensions
Mcknight well built extensionsRichard McKnight
 
AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)Igor Talevski
 
Rules. Обзор, примеры, API.
Rules. Обзор, примеры, API.Rules. Обзор, примеры, API.
Rules. Обзор, примеры, API.DrupalForumZP2012
 
Informatica power center online training
Informatica power center online trainingInformatica power center online training
Informatica power center online trainingSmartittrainings
 
Informatica online training from inida
Informatica online training from inidaInformatica online training from inida
Informatica online training from inidaQualitytrainings
 
Informatica online training from inida
Informatica online training from inidaInformatica online training from inida
Informatica online training from inidaQualitytrainings
 
Informatica online training from inida
Informatica online training from inidaInformatica online training from inida
Informatica online training from inidaQualitytrainings
 
Informatica online training from inida
Informatica online training from inidaInformatica online training from inida
Informatica online training from inidaQualitytrainings
 

Similar to Rules (20)

The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
 
Drupal 7 rules module
Drupal 7 rules moduleDrupal 7 rules module
Drupal 7 rules module
 
Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)
 
Puppet camp london nov 2014 slides (1)
Puppet camp london nov 2014   slides (1)Puppet camp london nov 2014   slides (1)
Puppet camp london nov 2014 slides (1)
 
AngularJS
AngularJSAngularJS
AngularJS
 
Automation using Puppet 3
Automation using Puppet 3 Automation using Puppet 3
Automation using Puppet 3
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS
 
Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Hadoop Eagle - Real Time Monitoring Framework for eBay Hadoop
Hadoop Eagle - Real Time Monitoring Framework for eBay HadoopHadoop Eagle - Real Time Monitoring Framework for eBay Hadoop
Hadoop Eagle - Real Time Monitoring Framework for eBay Hadoop
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
 
Mcknight well built extensions
Mcknight well built extensionsMcknight well built extensions
Mcknight well built extensions
 
AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)
 
Rules. Обзор, примеры, API.
Rules. Обзор, примеры, API.Rules. Обзор, примеры, API.
Rules. Обзор, примеры, API.
 
Informatica power center online training
Informatica power center online trainingInformatica power center online training
Informatica power center online training
 
Informatica online training from inida
Informatica online training from inidaInformatica online training from inida
Informatica online training from inida
 
Informatica online training from inida
Informatica online training from inidaInformatica online training from inida
Informatica online training from inida
 
Informatica online training from inida
Informatica online training from inidaInformatica online training from inida
Informatica online training from inida
 
Informatica online training from inida
Informatica online training from inidaInformatica online training from inida
Informatica online training from inida
 

Recently uploaded

Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji EscortsFun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji EscortsApsara Of India
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Documentf4ssvxpz62
 
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzersQUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzersSJU Quizzers
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607dollysharma2066
 
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCRdollysharma2066
 
The Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty VixenThe Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty VixenSalty Vixen Stories & More
 
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170Sonam Pathan
 
LE IMPOSSIBRU QUIZ (Based on Splapp-me-do)
LE IMPOSSIBRU QUIZ (Based on Splapp-me-do)LE IMPOSSIBRU QUIZ (Based on Splapp-me-do)
LE IMPOSSIBRU QUIZ (Based on Splapp-me-do)bertfelixtorre
 
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一lvtagr7
 
Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713Sonam Pathan
 
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceCall Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceTina Ji
 
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa EscortsCash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa EscortsApsara Of India
 
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...Amil Baba Company
 
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...Amil Baba Company
 
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...Amil baba
 
Call Girls Prahlad Nagar 9920738301 Ridhima Hire Me Full Night
Call Girls Prahlad Nagar 9920738301 Ridhima Hire Me Full NightCall Girls Prahlad Nagar 9920738301 Ridhima Hire Me Full Night
Call Girls Prahlad Nagar 9920738301 Ridhima Hire Me Full Nightssuser7cb4ff
 
Call Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call GirlsCall Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call Girlsssuser7cb4ff
 
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts ServiceVip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts ServiceApsara Of India
 
Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713Sonam Pathan
 

Recently uploaded (20)

Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji EscortsFun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Document
 
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzersQUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377087607
 
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
 
The Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty VixenThe Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty Vixen
 
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
 
LE IMPOSSIBRU QUIZ (Based on Splapp-me-do)
LE IMPOSSIBRU QUIZ (Based on Splapp-me-do)LE IMPOSSIBRU QUIZ (Based on Splapp-me-do)
LE IMPOSSIBRU QUIZ (Based on Splapp-me-do)
 
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
 
Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713
 
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceCall Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
 
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa EscortsCash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
 
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
Amil Baba in karachi Kala jadu Expert Amil baba Black magic Specialist in Isl...
 
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
 
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
 
Call Girls Prahlad Nagar 9920738301 Ridhima Hire Me Full Night
Call Girls Prahlad Nagar 9920738301 Ridhima Hire Me Full NightCall Girls Prahlad Nagar 9920738301 Ridhima Hire Me Full Night
Call Girls Prahlad Nagar 9920738301 Ridhima Hire Me Full Night
 
Call Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call GirlsCall Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call Girls
 
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts ServiceVip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
 
young call girls in Hari Nagar,🔝 9953056974 🔝 escort Service
young call girls in Hari Nagar,🔝 9953056974 🔝 escort Serviceyoung call girls in Hari Nagar,🔝 9953056974 🔝 escort Service
young call girls in Hari Nagar,🔝 9953056974 🔝 escort Service
 
Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713
 

Rules

  • 1. Rules Overview, use cases, API Artem Berdishev skype: berdishev berdart@amgrade.com
  • 2. What is Rules? • Module for developers • Custom code replaced by some configuration • Interaction between different modules 2
  • 3. Rules features • Token and Entity Token • Loops & Lists • Nice debug mode • Components • Scheduler 3
  • 4. Rule architecture • Events – system event(s) to which one(s) rule will react • Conditions • Actions 4
  • 5. Rule architecture • Events • Conditions – in which cases it should react? • Actions 5
  • 6. Rule architecture • Events • Conditions • Actions – what should happen? 6
  • 7. Components • This is reusable part of rules • Use them in creation rules • Condition set (OR/AND), Action set, Rules set • Components’ evaluation can be scheduled (module Rules Scheduler) 7
  • 8. Useful modules • Rules links • Flag • Views Bulk Operations • Message • Rules Bonus Pack • Content access • ….. 8
  • 9. Some small examples • On node creation/saving change URL alias pathauto • Notify admin (moderator, author) about content posting notification • Notify user (author) about new comments for node comment_notify • Custom breadcrumbs for node types custom_breadcrumb • … 9
  • 10. Big example - Workflow • Users can add content (status = waiting for approval). It’s not published • The notification will be sent to administrator • He could change status to Approved or Declined (+ notification to the author) • If Approved – author can publish/unpublish content 10
  • 11. Scheduled publishing • Field for setting publishing (unpublishing) date • Components for (un-)publishing and logging • Rule for – reaction on changing date field – scheduling the component evaluation Scheduler 11
  • 13. Best practices • Make use of tags • Use components to organize your rules • Export your rules to feature modules using Features • Keep your rules simple 13
  • 14. RULES API 14
  • 15. Event API • hook_rules_event_info() – array keyed by event name; – options: title, group, variables etc; • rules_invoke_event() – call this function with event name as argument to trigger the event – for example, in any hook function 15
  • 16. Action API • hook_rules_action_info() – array – action name (prefixed with module name) as key; – options: label, group, parameter, provides, callbacks, etc. • Implement function [action_name]() – function arguments match parameters + $settings; – returns array of parameter or/and provides with their name as key; 16
  • 17. Condition API • hook_rules_condition_info() – array – condition name (prefixed by module name) as key; – options: label, parameters, group etc. (same as action) • Implement function [condition_name]() – function arguments match parameters + $settings; – should return boolean value; – can't provide variables; – cannot save parameters. 17
  • 18. Rules API • hook_rules_data_info() • hook_rules_plugin_info() • hook_rules_evaluator_info() • hook_rules_data_processor_info() • hook_rules_[action|event|…]_info_alter() • hook_default_rules_configuration() • ….. 18
  • 19. Resources • The Rules module page on d.o. http://drupal.org/project/rules • The Rules way of life (London 2011) http://london2011.drupal.org/conference/sessions/rules-way-life • Screencast by Johan Falk (Itangalo) http://dev.nodeone.se/en/learn-the-rules-framework • Demo sandbox on d.o. http://drupal.org/sandbox/BerdArt/1434760 19
  • 20. Question? Artem Berdishev skype: berdishev berdart@amgrade.com