Problem/Motivation
The media library needs a field handler to select one or more items from a view. That is to be introduced in #2834729: [META] Roadmap to stabilize Media Library. Since a selection component is similar to a bulk form, but not exactly the same, it makes sense to refactor bulk forms to share their common implementation with select forms.
Proposed resolution
1. Extract some methods from the BulkForm to a base class and use it in BulkForm.
2. Change id generation in bulk forms so Ajax operations are also supported.
Remaining tasks
TBD
User interface changes
None.
API changes
The bulk form element IDs are changed because they are not unique if there is an Ajax action on the form. The current bulk form identifiers are increasing numeric items, which when an Ajax reload happens would not necessarily be the same anymore. $bulk_form_key becomes a unique identifier based on entity type, entity id, entity revision and language. This is important also if you want to reference a specific revision and/or language of an entity.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#29 | 2834777-nr-bot.txt | 132 bytes | needs-review-queue-bot |
#17 | 2834777-17.patch | 12.1 KB | chr.fritsch |
#11 | interdiff-6-11.txt | 1.02 KB | seanB |
#11 | 2834777-11.patch | 11.54 KB | seanB |
#6 | 2834777-6.patch | 11.54 KB | webflo |
Comments
Comment #2
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #4
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #5
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #6
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #7
Gábor HojtsyThere is no SelectForm plugin yet in this patch. if that proposed for inclusion in views module? I was curious why is this against the system component, so:
Does this functionality REALLY belong in a general PluginBase component? Would this be so widely applicable?
Comment #8
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedThanks for the review, i have to rewrite a new issue summary because i just created a new base class. The SelectForm plugin itself is currently media_library. $bulk_form_key is super helpful because it creates a unique identifier based on entity type, entity id, entity revision and language. This is important if you want to reference a specific revision and/or language of a entity.
Comment #9
Gábor HojtsyComment #11
seanBRerolled since patch no longer applied (short array syntax caused the issue).
Comment #12
chr.fritschLet's trigger testbot
Comment #17
chr.fritschRerolled because of #2916451: Move everything related to Bulk Form to Views module lands in between.
I also think we should have some tests here.
Comment #19
phenaproximaThis issue no longer blocks any media library work, so we can remove #2834729: [META] Roadmap to stabilize Media Library as the parent issue.
Comment #29
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.