Problem/Motivation

If I put more than 20 blocks or fields in a section and try to reorder it later, it doesn't save the correct order for the last few items. If I enable to display row weights there, I see that it only supports weights ranging from -10 to +10.

Proposed resolution

Increase the range.

Remaining tasks

Fix
Fail test
Manual testing
Review

User interface changes

The Move Form will work for any number of blocks

API changes

none

Data model changes

none

Release notes snippet

TBD

Comments

kaszarobert created an issue. See original summary.

kaszarobert’s picture

Status: Active » Needs review
StatusFileSize
new486 bytes

I made a patch to increase the possible weight values. Now a wider range can be selected, between -100 to 100.

sam152’s picture

Status: Needs review » Needs work

Why don't we count the number of elements we are weighting, to prevent this from ever being an issue in the future? \Drupal\workflows\Form\WorkflowEditForm::form has an example of this:

    $state_weight_delta = round(count($states) / 2);
...
        'weight' => [
          '#type' => 'weight',
          '#title' => t('Weight for @title', ['@title' => $state->label()]),
          '#title_display' => 'invisible',
          '#default_value' => $state->weight(),
          '#attributes' => ['class' => ['state-weight']],
          '#delta' => $state_weight_delta,
        ],

Would also be good to test this.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

kunalgautam’s picture

Assigned: Unassigned » kunalgautam
kunalgautam’s picture

StatusFileSize
new992 bytes

Patch for drupal 9.

kunalgautam’s picture

Assigned: kunalgautam » Unassigned
Status: Needs work » Needs review
priyanka.sahni’s picture

Assigned: Unassigned » priyanka.sahni
priyanka.sahni’s picture

Assigned: priyanka.sahni » Unassigned
StatusFileSize
new485.49 KB
new355.84 KB

Verified and tested by applying the patch #7.On adding more than 20 blocks in the section , counts accordingly gets increased in the row weights section.It looks good to me.Can be moved to RTBC.RTBC +1.

Steps to test -
1. Go to admin site.
2. Go to /admin/modules.
3. Enable the layout builder and discovery.
4. Go to admin/structure/block/block-content
5. Add custom block.
6. Go to admin/structure/types/manage/article/display/default/layout.
7. In the section , add 34 blocks.Re order it.
8. Click on edit icon in the block , click on move.
9. On the right side , pop-up gets opened , you will see the row weights.
10. Row weights should be according to the blocks added in the section.If block is 34 than -17 to 17 will display in row weights.

Before -
BeforePatch

After -
After Patch

tim.plunkett’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

The fix looks good, but this needs automated test coverage

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

danflanagan8’s picture

Status: Needs work » Needs review
StatusFileSize
new4.9 KB

Here's a fail test. It's pretty simple, but a couple notes...

1. I add 25 blocks to a new section at one point in the test. The test fails on any number over 20.
2. After adding 25 identical blocks, I cannot rely on assertRegionBlocksOrder because that function expects unique blocks.

Status: Needs review » Needs work

The last submitted patch, 16: 3077646-16-FAIL.patch, failed testing. View results

danflanagan8’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new4.44 KB
new2.4 KB

Test failed as expected. Removing tag.

Here's the patch from #7 applied atop the fail patch.

Note that the interdiff includes changes related to running all test now while only running the updated test in #16. Saving energy, time, money, etc.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Triggering for 10.1

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

Change passes 10.1
Issue summary has no more remaining tasks and clear proposed solution.

Fail patch proves this issue.

  • catch committed 74f7e5ac on 10.1.x
    Issue #3077646 by danflanagan8, kkalashnikov, kaszarobert, priyanka....
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 10.1.x, cherry-picked to 10.0.x and 9.5.x, thanks!

  • catch committed c0ea6ffe on 10.0.x
    Issue #3077646 by danflanagan8, kkalashnikov, kaszarobert, priyanka....

  • catch committed 9c359056 on 9.5.x
    Issue #3077646 by danflanagan8, kkalashnikov, kaszarobert, priyanka....

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.