Problem/Motivation
(original report motivation)
The default action on /admin/content
is "Delete selected content". It's really easy to push "Apply" button by mistake, thinking it will apply the filter, because of the button title, and because it's positioned at the bottom of the form, typically where people expect to look for submit buttons. (This actually happened to me today, and I've been using Drupal for 8 years)
Steps to reproduce
See screenshots.
Proposed resolution
MR to review !4583
Proposal:
- Store the order of the actions in the Views Bulk Form handler configuration (actually, the View config entity)
- Provide an upgrade path to set the order config in each Bulk Form field but preserve BC. On existing sites the order should be preserved even the "dangerous" actions are on top. Then site builders might decide to manually change that.
- For new sites provide a default order that is safe. Specifically, the "Delete" action should be the last in the list avoiding incidents.
A little history>
Initially, adding a weight to action config entities has been tried. However, as is mentioned in #152, this is not the correct approach as an action (read a config entity) may appear on several views and the site builder may need different sort orders on each view. Read the #152 comment for more background.
Remaining tasks
None.
User interface changes
Bulk Form admin form
Before:
The checkboxes let you select which actions will be available, but you cannot control the order.
After:
The form element used to select the actions is converted from checkboxes
to draggable table
. The table allows both, actions selection and action reordering.
Views with Bulk Form
The actions are reordered for new sites on /admin/content
, /admin/content/comment
, /admin/content/comment/approval
, /admin/content/media
with the "Delete" action as last option.
Before:
After:
API changes
None.
Data model changes
New actions_order
option for Bulk Form handler.
Release notes snippet
Use drag and drop in Views bulk form field configuration form to define order which will be used to expose the actions in the bulk forms.