Site Building

Using Rules Components with More Than One Parameter for Drupal 7

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

Rules guide (Drupal.org)

Sprout Video

This screencast shows “how you can use multiple-parameter Rules components in VBO and get the additional parameters as action configuration,” which translates to:

  • If you have more than one parameter for a Rules component, you can still use it with VBO.
  • Any additional parameters will be displayed as action configuration, meaning that the person executing the VBO gets to choose parameter value.
  • Sadly, you can’t access data from the view item being actioned – you’ll have to stick with fixed input values. (If you want to use data from the processed item, you could actually do this inside the Rules component!) This is an issue being worked on.
  • If you have complex parameters – such as taxonomy terms instead of just an integer – you can (mostly) use entity ID in the direct input mode.
  • You can, by coding, change the form elements used for input. It is probably better to target the Rules data widget than doing a standard form_alter, but both will work.
  • You could, for example, use this for changing comment settings on nodes, or adding selected tags to nodes. (Both examples shown in this screencast.) You could also use it for, say, sending customized messages or something. Or cloning existing nodes with changes specified in parameters.
  • Bonus: If you add an entry to a multiple-value field in an entity, Rules won’t pick up that the entity has changed – make sure to add a “save entity” action in the rule.

Not mentioned in this screencast but still good to know:

  • You can have Rules components without any parameters as well. No sweat.
  • You can use Rules components without any parameters matching the View type too. In that case, you’ll have to specify all the parameters manually.
  • If you have a component with several parameters matching the view type, the first one will be auto-populated by VBO – the rest you have to set manually.

Additional resources

Rules guide (Drupal.org)