Drupal 7 Rules Guide

A short list of tricks to work with different parts of Rules. I'll continue adding to this guide as I learn.

RulesAnd Object

Ubercart tax rules are configured to use the RulesAnd (rules_and function) which changes how you retrieve getElementName() and settings(). Their file uc_taxes.rules_defaults.inc is responsible for creating a settings page where you can add conditions to a new tax rate.  Here's the code:

Read more

Drupal 7 Creating New Actions for Rules

Code dump for my personal reference. I'll build on this topic as I continue to learn.

Read more

Drupal 7 Programmatically Creating a Rule with a Custom Action

Commerce module uses Rules module extensively. Unlike Ubercart where you can just call a hook and receive $account information of the final process once an anonymous user is converted to a Drupal authenticated user, once checkout is complete.  With Commerce we have to use Rules to create a custom rule with an action that ultimately executes a callback....Yes, I know....

Here's the example of what we did. Look at the code comments for a better hint of what is going on.

 

Read more
  •  
  • 1 of 3