Last updated November 1, 2012. Created by fago on August 10, 2010.
Edited by gollyg, mitchell, August1914. Log in to edit this page.

Rules makes use of metadata for dealing with entities and their properties. A good strategy to integrate with Rules is by providing metadata with the Entity API. To add new entity types and entity metadata see its supported properties).

rules architecture

  • If you provide a new entity type to the system, use its additional hook_entity_info() keys to tell it how your entity is saved / deleted / created and to specify an access callback - Rules will pick that up. Additionally implement hook_entity_property_info() for providing metadata about the existing entity properties. In particular, be sure to mark properties required to create an entity with 'required' => TRUE as this is required for the 'entity_create' action to function.
  • Implement hook_entity_property_info_alter() in order to add metadata about any properties your module adds to existing entity types.

All properties known to the Entity API are accessible in Rules for use as arguments via the data selectors. If a 'setter callback' is provided, the data property can be modified via the "Set data value" action. Also, Rules makes use of any given 'options list' callback or any specified access info.

For more details check the Entity API docs.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.