Button Field Example

This project is not covered by Drupal’s security advisory policy.

Adds a button field type for use with any fieldable entity type integrated with Rules. When the button is clicked, a Rules event is triggered allowing you to do actions such as display a message to the user, alter some data on the entity (or another entity) or reload the current (or any other) page. The module provides two different widgets: HTML Button and Image Button. It adds a new button click event, clicked button comparison, and reload page action for use with rules.

Drupal 9 port

This module is currently minimally-maintained.. If you are interested in becoming a co-maintainer, please create an issue in the issue queue.

Upgrading from Drupal 7

A field migration is provided to migrate any button fields from Drupal 7 to Drupal 8 or greater.

Differences from Drupal 7 version

  1. The "Button field reload" action has been removed, and you should use the Rules Core "Page redirect" action instead.
  2. AJAX button field redirects are not currently implemented.

Drupal 7 port

Upgrading from Drupal 6

This module provides no update path of its own from Drupal 6 to Drupal 7. To migrate your existing fields, take a look at Migrating D6 Content Construction Kit (CCK) to D7 Fields. To update your rules, read the "Upgrade from Rules 6.x-1.x to Rules 7.x-2.x" section of the README included in the Rules module. You must have Button Field alpha 2 or later installed in order to update your rules. Any button fields previously added to views will need to be re-attached to those views.

Important note

Due to #1452894: Elements with #has_garbage_value and #value are always set as a triggering element you can not use image buttons on edit forms when there are any other buttons. Non-editable displays are unaffected.

Differences from Drupal 6 version

  • Works with any fieldable entity
  • Entity parameter provided with the rules event will contain any form values from the edit form
  • Makes much better use of Drupal's Forms API (FAPI)
  • Utilizes Drupal's Ajax Framework

Project information

Releases