Hi,

I wasn't sure if this should have gone in comments of #1987952: Blocks are not rendered in order by weight, but here it is.

I git pull'd Drupal8 a few hours ago, and I faced the same problem. I configured my module, and placed its blocks in the first sidebar of the Bartik theme. Even though I placed currency first and gold after that, it was gold first and currency after that when I looked at the front page.

Regards,
K.

35.png

36.png

Files: 
CommentFileSizeAuthor
#12 2087009_12.patch1.41 KBvedpareek
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 83,940 pass(es), 59 fail(s), and 29 exception(s). View
#6 block-order-2087009-6.patch1.77 KBdealancer
PASSED: [[SimpleTest]]: [MySQL] 59,248 pass(es). View
#4 block-order-2087009-4.patch1.75 KBdealancer
FAILED: [[SimpleTest]]: [MySQL] 59,333 pass(es), 1 fail(s), and 0 exception(s). View
Screenshot from 2013-09-11 22:23:36.png27.02 KBKartagis
Screenshot from 2013-09-11 22:22:35.png20.22 KBKartagis

Comments

Kartagis’s picture

I've just realised that they are in correct order if I later play with the order.

dealancer’s picture

So do they appear in the correct after a first or a second order form submitting?

dealancer’s picture

I confirm. Issue exists. It happens because the new blocks has the same order (-5). However they are shown differently in the list on the block layout page an on the regular Drupal page.

dealancer’s picture

Status: Active » Needs review
FileSize
1.75 KB
FAILED: [[SimpleTest]]: [MySQL] 59,333 pass(es), 1 fail(s), and 0 exception(s). View

Here is a patch that uses same comparison function in the different places in block module. Comparison function is pretty defined and sorts by a weight first, then by an id.

Status: Needs review » Needs work

The last submitted patch, block-order-2087009-4.patch, failed testing.

dealancer’s picture

FileSize
1.77 KB
PASSED: [[SimpleTest]]: [MySQL] 59,248 pass(es). View

It failed a test. Blocks with identical weights should be sorted in the reverse order. Fixing that. Changed the sort direction for the block ids.

dealancer’s picture

Status: Needs work » Needs review
swentel’s picture

Title: Block order (again) » Make sure weights are unique when using tabledrag
Component: block.module » javascript
Issue tags: +JavaScript

This happens in every place where we're using tabledrag and weights. So this would only fix it for blocks. This also happens on the manage display pages for instance.

Moving to javascript component to see how they feel about this because that's really the best place imo to fix it.

dealancer’s picture

Not sure that the JS is a really good way to fix it. Imagine if we are adding blocks programmatically and than check order on the backend and frontend. Unless we click save button, there can be different orders.

We just need to write good PHP code, because we could not rely on JS if it is disabled.

dcam’s picture

Issue summary: View changes
Issue tags: +needs backport to D7

Closed #2099211: Block order as a duplicate. The author created it as a follow-up to report the issue for 7.x.

jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
vedpareek’s picture

Issue tags: -JavaScript, -needs backport to D7, -Needs reroll +SprintWeekend2015
FileSize
1.41 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 83,940 pass(es), 59 fail(s), and 29 exception(s). View

Rerolled

charginghawk’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: 2087009_12.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.