Click here to load reader
Upload
scott-povlot
View
451
Download
2
Embed Size (px)
DESCRIPTION
The Rules module can be used to automate simple and complex tasks on your Drupal site without programming. Learn how to use standard Rules features to modify content, notify users, or redirect URLs. Then we will look at how Rules integrates with other Drupal modules like Flag and Views to provide even more power. We will see how Rules provides amazing flexibility to customize your site.
Citation preview
Drupal Rules! Scott Povlot (@spovlot)
Drupalcamp Atlanta 2012
October 27, 2012
DrupalCamp Atlanta #DcATL #drupal-rules
Why Rules?
Add Custom Functionality in Drupal
Create Complex Reactions to Events
Integration with lots of Modules
Fast Development
No Programming Necessary
DrupalCamp Atlanta #DcATL #drupal-rules
Rules Integration Drupal Core
Entity API
Flags
Views Bulk Operations
Commerce and Ubercart
Organic Groups (OG)
UserPoints
VotingAPI
DrupalCamp Atlanta #DcATL #drupal-rules
Anatomy of a Rule
Reaction Rule
Event
Condition (optional)
Action
Loop
DrupalCamp Atlanta #DcATL #drupal-rules
Events When to Perform the Rule
Core Events
User has logged in
After saving new content
A comment is viewed
Contributed Module Events
A node has been flagged, under "Like" (Flag)
Customer completes checkout (Ubercart)
DrupalCamp Atlanta #DcATL #drupal-rules
Actions What to do when the Rule is executed
Core Actions
Send mail
Add a user role
Calculate a value
Create an entity
Page redirect
Contributed Module Actions
Unflag a node (Flag)
Update order status (Ubercart)
DrupalCamp Atlanta #DcATL #drupal-rules
Conditions If the Conditions are True, Perform the Actions
And's & Or's
Core Conditions
Content is of type
Entity has a field
Data Comparison
User has role(s)
Contributed Module Conditions
Entity is a group (OG)
Check if order can be shipped (Ubercart)
DrupalCamp Atlanta #DcATL #drupal-rules
Redirect after Login Example
Demonstration
DrupalCamp Atlanta #DcATL #drupal-rules
Variables Default “site” information
Current User
Provided by events
or actions
Node
User
Entity
Types
Text, Integer, Decimal, Truth Value, Date, Entity
Lists and Loops Lists
Multiple value fields
Fetch entity by property
Fetch users who have flagged a ...
Load from a VBO View
Loops
Iterate over a lists of data
Perform actions on each item
DrupalCamp Atlanta #DcATL #drupal-rules
“Hints” via Conditions Add one of the following conditions
Content is of type
Entity is of type
Entity has field
When Rules does not show type specific fields
DrupalCamp Atlanta #DcATL #drupal-rules
“Follow” Content Example
Demonstration
DrupalCamp Atlanta #DcATL #drupal-rules
Rules Components Reusable Chunks of Rules
Condition set (OR)
Condition set (AND)
Action set
Rule
Condition and Actions without an event
Rule set
DrupalCamp Atlanta #DcATL #drupal-rules
VBO Action with Rules Demonstration
DrupalCamp Atlanta #DcATL #drupal-rules
Debugging Rules Rules Settings
admin/config/workflow/rules/settings
Show debug information - Always
DrupalCamp Atlanta #DcATL #drupal-rules
Rules Resources
http://drupal.org/project/rules
http://nodeone.se/en/learn-the-rules-framework
http://nodeone.se/en/coding-for-rules-2
http://tinyurl.com/rulesmastery
http://archive.org/details/TheTinydrupalBookOfRules
DrupalCamp Atlanta #DcATL #drupal-rules
Questions?
Drupal Rules!
Scott Povlot (@spovlot)
Drupalcamp Atlanta 2012
October 27, 2012
#DcATL #drupal-rules
DrupalCamp Atlanta #DcATL #drupal-rules