Problem/Motivation

BulkForm::viewsFormSubmit() shows "%action was applied to @count items." using the number of selected entities the user has access to, counted before the action runs. If an action skips some items for its own reasons, the message still reports every selected item as processed.

For example, the "Refresh from source" media action in #2983456 skips media items whose source is missing or unavailable. The usability review there (comment 200) asked for the status message to count only the items that were actually refreshed. That isn't possible from inside an action today, so #2983456 adds a warning that states how many of the selected items were skipped, while the bulk form's own message still reports them all.

Proposed resolution

Let an action report how many items it actually processed, for example through an optional interface on the action plugin that BulkForm checks after execute(), and use that number in the status message. Actions that don't implement it keep today's behaviour.

Remaining tasks

Agree on the API, implement it with tests, and then use it in the media "Refresh from source" action.

API changes

A new optional interface for action plugins. No change for existing actions.

Issue fork drupal-3634563

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

glynster created an issue. See original summary.

shubhamgoel made their first commit to this issue’s fork.

shubhamgoel’s picture

Status: Active » Needs review

Hi,

I've added the optional interface and BulkForm now uses it, with a functional test. please review and merge the MR https://git.drupalcode.org/project/drupal/-/merge_requests/17649/diffs.