The Tiny Book of Rules

Categories:

Recommended

Rules is a module usually used to automate actions on your Drupal site. Rules can react on events occurring on your site – such as a user logging in or a node being created – and perform customized follow-up actions such as redirecting to a certain page or setting field values. Optionally, Rules can evaluate conditions before executing any actions.

Rules is also a framework to use by other modules, allowing them to evaluate user-configured Rules components, such as action and condition sets, or expose data about variables and entities to other parts of Drupal.

Rules in site building

Using actions

Rules actions are reactions that Rules may perform. Some actions return new data that Rules can work with – such as loading the most recent comment written by a user – but most actions only deal with the data already available to Rules.

Some common actions are:

  • Add a variable: This adds a new variable into your configuration, which then can be manipulated and used.
  • Calculate a value: This allows you to perform basic arithmetics with numbers.
  • Create a new entity: This asks for required data for an entity, and then creates it.
  • Fetch entity by id: This allows for fetching nodes and other entities by id.
  • Fetch entity by property: This allows for fetching all entities matching selected criteria, for example a selected field value.
  • Show a message on the site: This displays an on-site message.
  • Publish/unpublish content.
  • Create or delete any URL alias.
  • Send an e-mail.
  • Set a data value (described below).

Actions can be combined in chains, which allows for rules loading new objects and then acting on them. Contributed modules may provide more actions to Rules.

Category:

Attribution

Creative commons License. The Tiny Book of Rules. https://www.drupal.org/files/tiny-book-of-rules.pdf

VP Flipbook Maker

Convert your work to digital flipbook with VP Online Flipbook Maker! You can also create a new one with the tool. Try it now!