17

Click here to load reader

Drupal Rules!

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

Page 1: Drupal Rules!

Drupal Rules! Scott Povlot (@spovlot)

Drupalcamp Atlanta 2012

October 27, 2012

DrupalCamp Atlanta #DcATL #drupal-rules

Page 2: 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

Page 3: 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

Page 4: Drupal Rules!

Anatomy of a Rule

Reaction Rule

Event

Condition (optional)

Action

Loop

DrupalCamp Atlanta #DcATL #drupal-rules

Page 5: 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

Page 6: 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

Page 7: 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

Page 8: Drupal Rules!

Redirect after Login Example

Demonstration

DrupalCamp Atlanta #DcATL #drupal-rules

Page 9: Drupal Rules!

Variables Default “site” information

Current User

Provided by events

or actions

Node

User

Entity

Types

Text, Integer, Decimal, Truth Value, Date, Entity

Page 10: Drupal Rules!

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

Page 11: 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

Page 12: Drupal Rules!

“Follow” Content Example

Demonstration

DrupalCamp Atlanta #DcATL #drupal-rules

Page 13: 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

Page 14: Drupal Rules!

VBO Action with Rules Demonstration

DrupalCamp Atlanta #DcATL #drupal-rules

Page 15: Drupal Rules!

Debugging Rules Rules Settings

admin/config/workflow/rules/settings

Show debug information - Always

DrupalCamp Atlanta #DcATL #drupal-rules

Page 17: Drupal Rules!

Questions?

Drupal Rules!

Scott Povlot (@spovlot)

Drupalcamp Atlanta 2012

October 27, 2012

#DcATL #drupal-rules

DrupalCamp Atlanta #DcATL #drupal-rules