Entity type metadata

Last updated on
30 November 2019

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

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.

Help improve this page

Page status: No known problems

You can: