Rules - Drupal 7

DRUPAL 7 230706

Drupal 7 The information below is most suited to Drupal 7. It may or not be applicable to later versions of Drupal

Coding with Rules

Some helpful resources on how to do various development tasks with Rules to extend its power.

Creating Custom Events

Creating Custom Conditions

Creating Custom Actions

Describing Entity Properties to Rules

Use Case

If you have custom entity property (ex: an integer property labeled "enrollment_owner_uid") that you want to link to another Drupal entity or some other data (ex: a user entity), you'll need to describe that property to Rules and tell it how to load the information you want to associate with the property.

For a "From-Scratch Entity":

You'll need to implement hook_entity_property_info(). See this Drupal.org page and the contrib documentation for the hook for more details.

For an ECK-built or Already Existing Entity:

You'll need to implement hook_entity_property_info_alter(). Typically, the only alter that is necessary is changing the default "type" of the property to a Drupal entity type, the default getter/setter methods provided by the Entity module will do the rest, so you don't even need to write extra code. Here's an example:


Review History

Who

When

Status

Who

When

Status

 

 

 

Bob

20230706

Deprecated

Â