Alter forms via Context reaction. zOMG!
More friendly, exportable, GUI alternative to writing form_alter functions in custom module code. Set various form values, attributes, and element access based on any Context condition available, including contrib context plugins. This is useful for hidden field defaults, labels, or anything within the form API; but there are plenty of other reasons you might want contextual form alterations depending on the area of your site, user roles, etc. It's recommended that you save such things to Features so these configs are not being pulled from the database.
See the readme for some examples.
Just imagine these juicy tid bits...
- Change button text in the login block based on content type of the page.
- Preset a registration profile field (via formblock) based on an entity field value of the page.
- Within advanced search options, force specific content type based on site section.
- Preload content creation fields by the user role or profile values of the author.
Gotchas!
- Read the README
- Clear cache - Context is heavily cached, clear cache for Reactions to appear
- Careful with AJAX forms
- Careful when adding arrays
Need some help?
For insights on what's available, use the Form API Reference, great if you're new to Drupal coding. You'll also need to confirm the actual form array structure in order to traverse through any fieldsets or other structure down to the element you're intending to alter. If you're new to this you'll probably need to do the following: install the Devel module, create a custom module to output form structure for browsing (see README).
Roadmap: none yet #2143329: [tsm] Roadmap?
Happy altering.
Project information
- Project categories: Administration tools, Developer tools
21 sites report using this module
- Created by doublejosh on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.

