Rules
-
Upload
yaroslav-dorocshuk -
Category
Technology
-
view
332 -
download
2
description
Transcript of Rules
![Page 1: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/1.jpg)
Ruleshttp://drupal.org/project/rules
![Page 2: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/2.jpg)
Data selection
![Page 3: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/3.jpg)
Loops
![Page 4: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/4.jpg)
Examples
![Page 5: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/5.jpg)
Mark as spam• Flag (Mark as spam)• Rules:oUnpublish spam commentoBlock spammeroNotify moderator about bad user
• Messages in spam log
![Page 6: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/6.jpg)
Moderators' workflow• Fields:oModeration status fieldoUnpublish date field
• Fields permission • Rules for publishing and notification.• VBO and Rules for bulk operations• Message module for logging changes
![Page 7: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/7.jpg)
Demo
![Page 8: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/8.jpg)
Useful modules:
![Page 9: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/9.jpg)
Rules Bonus Packhttp://drupal.org/project/rb
Aditional triggers, actions and conditions.
![Page 10: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/10.jpg)
Views Bulk Operationshttp://drupal.org/project/views_bulk_operations
Run Your rules on the views-result.
![Page 11: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/11.jpg)
Flaghttp://drupal.org/project/flag
Trigger rules on flag/unflag any item.
![Page 12: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/12.jpg)
Rules Linkhttp://drupal.org/project/rules_link
Create links which trigger rules.
![Page 13: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/13.jpg)
Page Managerhttp://drupal.org/project/ctools
User rules conditions to check access for page.
![Page 14: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/14.jpg)
Content Accesshttp://drupal.org/project/content_access
Give role-based access to nodes with rules.
![Page 15: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/15.jpg)
Relationhttp://drupal.org/project/relation
Work with related entities and create relations.
![Page 16: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/16.jpg)
Difference in performance
Rules Custom module
Update user's name after account was updated. ~177,57 ms ~174,35 ms
Update user's name after node was viewed.
~230,5 ms ~193,06 ms
*Measurement was made on page load
![Page 17: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/17.jpg)
Difference in performance
![Page 18: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/18.jpg)
What does it mean?• ~40 ms additional page execution time• ~3 ms additional queries execution time• ~17 additional exuquted queries• ~3,5 mb additional RAM usage.
![Page 19: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/19.jpg)
Development• Provide your own ations and conditions using :
o hook_rules_action_info() o hook_rules_condition_info()
• Define entity properties using hook_entity_property_info of the entity API
![Page 20: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/20.jpg)
Use Rules because:• Rules is flexible• Rules is more clear for a customer• Rules intagrates with other modules• You can easily move needed functionality using
Features• Clicking is faster that writing a code
![Page 21: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/21.jpg)
Useful Links• Code exampels: http://drupal.org/project/rules_example• Documentation: http://drupal.org/node/878720• Screencasts:
o http://nodeone.se/node/984o http://london2011.drupal.org/conference/sessions/rules-wa
y-lifeo http://www.youtube.com/watch?v=1itm3t0YMfw
• Moderations' workflow feature: https://github.com/yarroha/Workflow-feature
![Page 22: Rules](https://reader035.fdocuments.in/reader035/viewer/2022062511/54bab8634a79591b588b45b1/html5/thumbnails/22.jpg)
Questions?
Yaroslav Doroshukemail: [email protected]: yarrohatwitter: https://twitter.com/#!/yarrohablog: http://yarroha.name/