O'Reilly logo

Drupal Rules How-to by Robert Varkonyi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Components – Reusing Rules, Conditions, and Actions (Must know)

This recipe explains the benefits of using Components by creating a Condition that can be re-used in other rule configurations.

In this scenario, we want to perform some action when a node is being commented on. But we only want to execute the action if the node was not created by the super admin (that is, user 1) and the node is either an article, or has an image field (field_image).

How to do it...

  1. Go to Configuration | Workflow | Rules | Components.
  2. Add a new component and set the plugin to Condition set (AND).
  3. Enter a name for the component and add a parameter Entity | Node.
    How to do it...
  4. Add a Condition, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required