rules_form_alter - rule in action

Experimental project

This is a sandbox project, which contains experimental code for developer use only.

This module allows you to to do use your favorite hook_form_alter techniques using rules

Objective:
Provide site developers access to all the power of the hook_form_alter through rules so they can store business logic along side other rules.

Currently provides:

  • An event rules_hook_alter
  • A condition to check the form id (option for contains or exact match)
  • An action to set a form element value using three parameters [name][key] = value
  • An action to set a form element [name] = array(...)
  • Works with commerce_stock: all actions are available from the add to cart validation event. Can be used to create additional form actions like 'download product image'

You can set multiple properties of a form elements using multiple actions like #markup, #weight & #default_value.

You can create new form elements or modify existing once

You can reference nested elements for fieldsets in the format of:
{fieldset}/{fieldset}/{form element}

Also check out Rules Forms Support for similar functionality.
Rules Forms Support is more user friendly while this module is more programer friendly and as a result is much more powerful with a fraction of the code. However it does require some technical understanding of the formapi and arrays.

Doesn't work or have a great idea let me know

Project information