Skip to content

Cannot designate a 'primary' or 'danger' form action unless both are specified #7023

@DevinCarlson

Description

@DevinCarlson

Description of the bug

form_process_actions() in core/includes/form.inc designates a form's first action (button) as the 'primary', unless one has already been specified manually. It does this by inspecting each action to see if it has either a 'button-primary' or 'button-danger' class. However, the current logic requires the button to have both classes instead of just one or the other.

Steps To Reproduce

To reproduce the behavior:

  1. Create a form with two actions (buttons).
  2. Specify that the second button is the 'primary' via ['#attributes']['class'][] = 'button-primary'; or ['#attributes']['class'][] = 'button-danger';
  3. View the form.

Actual behavior

The first button is incorrectly displayed as the primary (highlighted with a blue background).

Expected behavior

The second button should be displayed as the primary (highlighted with a blue or red background).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions