Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Break the-rules


Published on

All you need to know is "If X then Y" and Rules. Code less do more. Easy interface, more control for admin, integration with workflows and mails. What more can you ask for ?
CCK, Views and Panels have been rightly called as the trilogy of Drupal. But there is more to it. It's actually the Quartet. And Rules is the lesser known module among the quartet. But for those who know Rules, Rules Rock I mean Rules Rule ;) So first lets learn Rules and then break them.

  • Be the first to comment

  • Be the first to like this

Break the-rules

  1. 1. Break The Rules gokul
  2. 2. AGENDA <ul><li>Me and my company </li></ul><ul><li>Introduction to Rules </li></ul><ul><li>Rules : What it can and what it can't do </li></ul><ul><li>Paradigm Shift : Think Triggers and actions </li></ul><ul><li>Rules settings and configurations </li></ul><ul><li>Best practices in using Rules </li></ul><ul><li>Coding with Rules in mind </li></ul><ul><li>Issues with Rules </li></ul><ul><li>Questions ???? </li></ul>
  3. 3. ‘ Me’ Bangalore
  4. 4. More about ‘Me’ <ul><li>I have worked on Java for close two years. </li></ul><ul><li>Looked into Drupal for the first time for a hobby project. </li></ul><ul><li>Most of my learning was through the community. </li></ul><ul><li>Left a well-paying job at Mindtree and joined a small company to learn Drupal. </li></ul><ul><li>And here I am </li></ul>
  5. 5. My Company <ul><li>We are based in </li></ul><ul><li>We code on </li></ul><ul><li>We build products & solutions using </li></ul>
  6. 6. What Rules can Do? <ul><li>If there a new article that is created </li></ul><ul><li>Then send a mail to the author saying that it is sent for approval process. </li></ul><ul><li>Send a mail to the editor saying that the article is waiting for his approval. </li></ul><ul><li>Auto-publish the node if the editor doesn't approve in three days time. </li></ul>
  7. 7. What Rules can't Do? <ul><li>If you are getting bored with your girlfriend or if she is not sexy any more, dump her and start searching for a new girlfriend. </li></ul>
  8. 8. Where rules stand
  9. 9. Triggers and actions
  10. 10. = Rules for the Web
  11. 11. Hooks <ul><li>A programming technique, used in Drupal, allows modules to “hook into” the flow of execution. </li></ul><ul><li>Hooks are a kind of triggers themselves. </li></ul>
  12. 12. Triggers <ul><li>Drupal's way of saying something significant has happened. A node has been created, updated or deleted. A user has registered, logged in, logged out and so on. </li></ul>
  13. 13. Define your own Trigger <ul><li>ProDrupal </li></ul>
  14. 14. Actions <ul><li>Tell Drupal what it should do when something important has happened(when something has been triggered). </li></ul>
  15. 15. Define your own actions
  16. 16. Rules Homepage
  17. 17. Create a new rule
  18. 18. Configure the Rule
  19. 19. After the Configurations
  20. 20. Workflow + Rules
  21. 21. Issues with Rules <ul><li>Rules modules is known to have few issues with the entities of Drupal 7 </li></ul><ul><li>Since Rules module uses the admin interface, your business logic can be distributed in admin interface and code. </li></ul><ul><li>Debugging can sometimes be a nightmare. </li></ul>
  22. 22. Rules of thumb - 1 <ul><li>Paradigm Shift : Think of user cases in terms of actions and triggers. </li></ul><ul><li>Keep the triggers and actions free from business logic. </li></ul><ul><li>Rules will take care of business logic and will work as glue for actions and trigger based on the Rules defined. </li></ul>
  23. 23. Rules of thumb - 2 <ul><li>MODULARITY : Keep the actions and trigger as atomic as possible. This will help in reuse of the actions and triggers </li></ul><ul><li>STRONG COHESION : Keep the rules with similar functionality together and make it a Rule Set. </li></ul><ul><li>WEAK COUPLING : Just know what an action performs. Don't depend on how the actions is performed or the sequence of event within a particular action. </li></ul>
  24. 24. Rules of thumb - 3 <ul><li>The major advantage with Rules is configurability and more access to the site admins. So keep the labels meaningful. Site admin should be able to read it like a story. </li></ul><ul><li>For a particular user-case logic implementation, either use Rules or custom code. Don't mix them both. Debugging can be a nightmare. </li></ul>
  25. 25. References <ul><li> </li></ul><ul><li> </li></ul>
  26. 26. Questions? Ask Gokul (that's me) Not satisfied? Ask Google Questions?