Problem/Motivation
When a section has more then 20 items we were not able to order them because we had to weight them with the same value. THis is caused by the weight's delta is not being overridden from the default of 10.
Steps to reproduce
Using Layout Builder for a node, add a section and then add more then 20 items to the section. To see the actual number, show weight values and the dropdown will not show anything more except "-10" -> "10". This is because the #delta for the weight field is not being set based on count of components.
Proposed resolution
Set delta variable to default 10.
Get count of components and if over 20, set a delta variable to ceil(count / 2).
set ['weight']['#delta'] to delta variable.
example found in core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php.
Remaining tasks
N/A
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3208972-layout-builder-moveblockform-2.patch | 1.18 KB | graper |
| #3 | 3208972-layout-builder-moveblockform.patch | 1.19 KB | graper |
Issue fork drupal-3208972
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:
- 3208972-layout-builder-moveblockform
changes, plain diff MR !564
Comments
Comment #2
graper commentedComment #3
graper commentedComment #5
graper commentedRe-roll patch.
Comment #6
gueguerreiroThis seems to be a duplicate of #3077646: Increase the delta of the "weight" field to support reordering more than 20 blocks in a section, which has been unfortunately blocked for a while until someone provides test coverage.
Comment #7
longwaveAgree that this is a duplicate.