Problem/Motivation
The DraggableListBuilder class is meant to be used to create draggable lists of configuration entities. However, it has specific requirements that are not clearly documented in the class itself, which can lead to confusion for developers trying to extend or use it correctly.
In particular:
- The entity type must declare a
'weight'entity key in itsentity_keys.
Steps to reproduce
- On a clean installation, generate a configuration entity with:
drush gen config-entity - Follow the prompt requests and drush will create your test config entity.
- Create some test content to check the list feature
- By default you will see the YourClassNameListBuilder file which extends ConfigEntityListBuilder
- Replace this to extends
extends DraggableListBuilder - The list page wont have the draggable feature on it.
Proposed resolution
Add proper documentation to the DraggableListBuilder class, including:
- A class-level docblock that explains its purpose and requirements.
Remaining tasks
- Add class documentation.
User interface changes
None.
Introduced terminology
None.
API changes
None. This change only adds documentation.
Data model changes
None.
Release notes snippet
Added documentation to the DraggableListBuilder class, clarifying the requirement for a 'weight' entity key in configuration entity types using this base class.
Issue fork drupal-3485650
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:
- 3485650-draggablelistbuilder-needs-to
changes, plain diff MR !11745
Comments
Comment #3
nitishchopra commentedComment #6
isa.belDocumentation added, moving to Needs Review status
Comment #7
smustgrave commentedPipeline appears to have issue.
For good practice issue summary should be filled in also, if sections don't apply can leave blank or add NA.
If you are another contributor eager to jump in, please allow the previous poster(s) at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!
Comment #9
brandonlira commentedHi,
I've rebased the branch onto the latest 11.x and fixed the coding standard issues.
All tests are now passing.
Please review when you have a moment, and feel free to let me know if anything else need.
Thank you!
Comment #10
smustgrave commentedAs a novice task would be good practice to update issue summary.
Comment #11
brandonlira commentedHi @smustgrave,
I've updated the issue summary to reflect the purpose and outcome of this task, including steps to reproduce the issue from a documentation perspective, and clarifying that this was a documentation-only change.
Please let me know if any further adjustments are needed.
Thanks!
Comment #12
brandonlira commentedComment #13
joachim commented- We only need class-level docblock
- getWeight() and setWeight() are not needed. The list builder uses the get() and set() method which all config entities have.
Comment #14
brandonlira commentedHi @joachim,
I've removed MR !11745 the method-level docblocks for getWeight() and setWeight() as suggested. The class-level and constructor documentation were kept to clarify usage requirements. Let me know if anything else should be adjusted.
Thank you!
Comment #15
joachim commentedThe IS needs updating too.
We really don't need docs on __construct -- they will just duplicate the class docs.
This is useful, but put it as an inline comment at the top of the method code.
The docs in this MR all seem very verbose -- it's not AI generated is it?
Comment #16
brandonlira commentedHi @joachim,
I’ve made the changes you suggested, removed the docblock from __construct() and added the inline comment at the top of the method.
About the wording: I’m not sure if any of it was AI-generated, as the work had already been started by someone else. I just continued from what was already there.
Let me know if anything else needs changing.
Comment #17
joachim commentedLeft some comments.
Comment #19
igorgoncalves commentedIssue summary update.
Comment #20
igorgoncalves commentedHi guys,
i agree with @joachim that a lot of new comments seems redundant.
So, i made some changes which i think has enough to inform what and how we can enable the draggable list feature.
So, assuming you follow the steps-to-reproduce, the drush generator create my test entity type just like:
so, simply adding the

"weight" = "weight"into that, the draggable will works (as screenshot below)then i thought add this simple code example at class docblock could be useful aswell.
i also removed the new "inline comment" from the construct, as the whole information at those lines already being explained at the method.
Comment #21
joachim commentedThat seems like overkill to me. It's also less clear than saying in words what is needed.
Developers using this class will be creating custom entity types, so they should know what an entity keys property is.
Comment #22
igorgoncalves commentedFair enough.
code example removed.
Comment #23
joachim commentedLooks good, though removal of the __construct() docblock seems unrelated?
Comment #24
smustgrave commentedGood catch! Can we add that back please
Comment #25
igorgoncalves commentedThanks for that Joachim.
Fix made.
Comment #26
joachim commentedThanks!
LGTM!
Comment #29
nod_Committed 5df135d and pushed to 11.x. Thanks!