Allow specifying "default actions" for BulkFormEntityListBuilder

Created on 27 June 2024, 6 months ago

Problem/Motivation

In #3018218: Add a list builder with support for bulk operations BulkFormEntityListBuilder was introduced which - to be consistent with core - relies on action config entities to exist for the particular entity type in order for the bulk operations to show. Note that the action plugins are perfectly capable of actually performing the respective action, the config entities are really just a wrapper for the plugins. And since - at least in core - there are only four actions (delete, publish, save, unpublish) and none of them have any plugin configuration, requiring to create boilerplate config entities just to get the actions to show up is unfortunate and goes against the ideal of reducing boilerplate for custom entities.

Proposed resolution

Let's add the notion of "default actions" for BulkFormEntityListBuilder: If no config actions can be found and the defaultActions property is set, set up those default actions for the UI at runtime.

Alternatively we could also add a separate list builder that does that, with the common bulk form logic living in a common base class, but that means one more level in the class hierarchy for (in my opinion) little gain.

I also propose adding three default actions by default: publish, unpublish, delete (in that order). This is slightly opinionated, but

  1. I find necessity of the "save" action to be fairly fringe, as far as I can tell, that mostly exists because it always has existed, but apart from some edge cases I don't really know what the use-case of that one is
  2. I think it's not practice to have the "delete" action be the first, and, thus, the one selected by default. Even if there is a confirmation form between some accidental clicks or Enter presses and data loss, I think it makes sense to avoid this anyway.

Remaining tasks

User interface changes

Lists using BulkFormEntityListBuilder have actions by default even without any action config entities. If entity types want to avoid this behavior, they are just one(-ish) line of code away from disabling this.

API changes

-

Data model changes

-

Feature request
Status

Needs review

Version

1.0

Component

Entity CRUD admin UI

Created by

🇩🇪Germany tstoeckler Essen, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024