DraggableListBuilder needs to document its expectations

Created on 5 November 2024, 7 months ago

Problem/Motivation

The DraggableListBuilder class is meant to be used to make entity lists, but it requires things which aren't immediately clear.

So far, that seems to be just this one:

- the entity type must declare a weight entity key

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Active

Version

11.0 ๐Ÿ”ฅ

Component

documentation

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @joachim
  • First commit to issue fork.
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil isa.bel Balneรกrio Camboriรบ

    isa.bel โ†’ made their first commit to this issueโ€™s fork.

  • Merge request !11745Document DraggableListBuilder class โ†’ (Open) created by isa.bel
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil isa.bel Balneรกrio Camboriรบ

    Documentation added, moving to Needs Review status

  • Pipeline finished with Failed
    2 months ago
    Total: 151s
    #466302
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Pipeline 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!

  • Pipeline finished with Failed
    2 months ago
    Total: 768s
    #468313
  • First commit to issue fork.
  • Pipeline finished with Failed
    26 days ago
    Total: 168s
    #495457
  • Pipeline finished with Success
    26 days ago
    #495458
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil brandonlira

    Hi,
    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!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    As a novice task would be good practice to update issue summary.

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil brandonlira

    Hi @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!

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil brandonlira
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

    - 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.

  • Pipeline finished with Success
    17 days ago
    Total: 552s
    #504322
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil brandonlira

    Hi @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!

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

    The IS needs updating too.

    We really don't need docs on __construct -- they will just duplicate the class docs.

    This constructor sets up the form builder for compatibility, disables
       *   pagination (to allow full drag-and-drop), and stores the weight key
       *   if it is defined in the entity type.
    

    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?

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil brandonlira

    Hi @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.

  • Pipeline finished with Success
    12 days ago
    Total: 620s
    #507101
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

    Left some comments.

  • First commit to issue fork.
  • Pipeline finished with Failed
    12 days ago
    Total: 157s
    #507461
  • Pipeline finished with Success
    12 days ago
    Total: 469s
    #507463
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil igorgoncalves

    Issue summary update.

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil igorgoncalves

    Hi 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:

     *   entity_keys = {
     *     "id" = "id",
     *     "label" = "label",
     *     "uuid" = "uuid"
     *   }
    

    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.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

    That 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.

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil igorgoncalves

    Fair enough.

    code example removed.

  • Pipeline finished with Success
    12 days ago
    Total: 372s
    #507604
Production build 0.71.5 2024