The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data...
Transcript of The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data...
![Page 1: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/1.jpg)
![Page 2: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/2.jpg)
The Rules Way of Life
Presented by Wolfgang Ziegler and Klaus Purer
Site Building and Environment Set-up
![Page 3: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/3.jpg)
Wolfgang Ziegler // d.o. fagowolfgangziegler.nettwitter.com/the_real_fago
Klaus Purer // d.o. klausiklau.sitwitter.com/_klausi_
![Page 4: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/4.jpg)
Rules?
http://drupal.org/project/rules
![Page 5: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/5.jpg)
Reactions
Event-Condition-Action
![Page 6: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/6.jpg)
Rules 2.0-rc1 for Drupal 7
What's new?
![Page 7: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/7.jpg)
Data selection
![Page 8: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/8.jpg)
Switch parameter input modes
This is the message.
![Page 9: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/9.jpg)
Create components!
Reusable configurations.
Rule sets, Action sets, Condition sets
Use them in reaction rules or other modules.
![Page 10: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/10.jpg)
Loops & Lists
![Page 11: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/11.jpg)
Improved debug log
![Page 12: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/12.jpg)
The Rules way of life
![Page 13: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/13.jpg)
Drupal is like Lego
Nodes, Fields, Views, …
+
glue code
![Page 14: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/14.jpg)
Drupal is like Lego
Nodes, Fields, Views, …
+
Rules
![Page 15: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/15.jpg)
Drupal is like Lego
Nodes, Fields, Views, …
+
Rules
+
less glue code
![Page 16: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/16.jpg)
Interacting modules.
![Page 17: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/17.jpg)
"The whole is more than the sum of its parts."
– Aristotle
![Page 18: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/18.jpg)
The holy four!
i. Views
ii.Flag
iii.Rules
iv.Message
![Page 19: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/19.jpg)
Modules to be replaced...
Scheduler, Workflow, Pathauto,Notifications, Messaging,
Casetracker, Custom breadcrumbs,
… your custom module?
![Page 20: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/20.jpg)
Is this a good idea?
![Page 21: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/21.jpg)
Let's do „Feature modules“?
Modules
have more dependencies
become harder to understand
→ Just as the sites we build
![Page 22: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/22.jpg)
Feature modules
→ Re-use existing stuff
→ Less work
→ Less code to maintain
→ More flexible solutions
→ Easy to adapt!
![Page 23: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/23.jpg)
Share and remixcustom-tailored solutions!
![Page 24: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/24.jpg)
Examples
![Page 25: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/25.jpg)
Mark as spam
Flag (Mark as spam / Mark as ham)
Rules:
Unpublish content marked as spam
Block spam users
Notify moderator about new content
Messages for spam history
![Page 26: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/26.jpg)
Simple workflow
Workflow state field(draft, needs-review, published)
Field permissions
Message + Rules for logging changes
Views for content listings, message logs.
Rules for publishing, notification
![Page 27: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/27.jpg)
Scheduled publishing
Date fields for publishing + unpublishing date
Rules Components for (Un-)Publishing + Logging
Reaction rules that
detect changed (un-)publishing dates
schedule component evaluation
![Page 28: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/28.jpg)
Notifications
Flag „Subscribe to a node“
Rule „Notify subscribers of changes“
Rules component „Notify a user“
User account field „Notification settings“
e.g. for choosing messaging channel
![Page 29: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/29.jpg)
Demo
![Page 30: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/30.jpg)
Best practices...
Make use of tags!
Use components to organize your rules
Export rules to feature modules using Features
Fear the devil: PHP module.
Keep your rules simple
![Page 31: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/31.jpg)
Useful modules
![Page 32: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/32.jpg)
Views Bulk Operationshttp://drupal.org/project/views_bulk_operations
Execute Rules components on Views-results.
![Page 33: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/33.jpg)
Rules Linkhttp://drupal.org/project/rules_link
Create custom links which trigger rules.
![Page 34: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/34.jpg)
Content Accesshttp://drupal.org/project/content_access
Grant role-based access to nodes with rules.
![Page 35: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/35.jpg)
Rules Bonus Packhttp://drupal.org/project/rb
A greenhouse for Rules functionality.
![Page 36: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/36.jpg)
Developing with Rules
![Page 37: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/37.jpg)
Extend Rules
Provide events, conditions and actions
Define entity properties using hook_entity_property_info of the entity API
Provide new entity types
![Page 38: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/38.jpg)
Make use of the Rules API
Actions API
Conditions API
Provide configurable components
Embed the UI, write tests!
![Page 39: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/39.jpg)
Developments & Outlook
Usability
Development ideas
Views, ctools, Entity forms, Web hooks
Drupal 8
– Entity API with Entity Property API
– Condition, Action API
![Page 40: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/40.jpg)
Question?
![Page 41: The Rules Way of Life - london2011.drupal.org · Rules 2.0-rc1 for Drupal 7 What's new? Data selection. Switch parameter input modes This is the message. Create components! ... your](https://reader033.fdocuments.net/reader033/viewer/2022043008/5f97185f579c3b3dd5206be4/html5/thumbnails/41.jpg)
THANK YOU!
What did you think?
Locate this session on the
DrupalCon London website:http://london2011.drupal.org/conference/schedule
Click the “Take the survey” link