Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
c9ff2332
Commit
c9ff2332
authored
May 24, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Issue
#1987952
by brantwynn, Freemantus: Fixed Order of rendered blocks is wrong."
This reverts commit
4f6113f5
.
parent
dc98af82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
67 deletions
+0
-67
core/modules/block/block.module
core/modules/block/block.module
+0
-4
core/modules/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php
...les/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php
+0
-63
No files found.
core/modules/block/block.module
View file @
c9ff2332
...
...
@@ -465,10 +465,6 @@ function block_list($region) {
$blocks
[
$region
]
=
array
();
}
uasort
(
$blocks
[
$region
],
function
(
$first
,
$second
)
{
return
$first
->
weight
<
$second
->
weight
?
(
$first
->
weight
===
$second
->
weight
?
0
:
-
1
)
:
1
;
});
return
$blocks
[
$region
];
}
...
...
core/modules/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php
deleted
100644 → 0
View file @
dc98af82
<?php
/**
* @file
* Definition of Drupal\block\Tests\BlockRenderOrderTest.
*/
namespace
Drupal\block\Tests
;
use
Drupal\simpletest\WebTestBase
;
/**
* Tests block HTML ID validity.
*/
class
BlockRenderOrderTest
extends
WebTestBase
{
/**
* Modules to enable.
*
* @var array
*/
public
static
$modules
=
array
(
'block'
,
'block_test'
,
'search'
);
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'Block Render Order'
,
'description'
=>
'Test blocks are being rendered in order by weight.'
,
'group'
=>
'Block'
,
);
}
function
setUp
()
{
parent
::
setUp
();
// Create a test user.
$end_user
=
$this
->
drupalCreateUser
(
array
(
'access content'
,
'search content'
,
));
$this
->
drupalLogin
(
$end_user
);
}
/**
* Tests the render order of the blocks.
*/
function
testBlockRenderOrder
()
{
//Enable test blocks and place them in the same region.
$blocks
=
array
(
array
(
$this
->
randomName
(
8
),
'system_powered_by_block'
),
array
(
$this
->
randomName
(
8
),
'search_form_block'
));
foreach
(
$blocks
as
$weight
=>
$settings
)
{
$this
->
drupalPlaceBlock
(
$settings
[
1
],
array
(
'label'
=>
$settings
[
0
],
'weight'
=>
$weight
,
'region'
=>
'header'
,
));
}
$this
->
drupalGet
(
''
);
$test_content
=
$this
->
drupalGetContent
(
''
);
foreach
(
$blocks
as
$weight
=>
$settings
)
{
$this
->
assertRaw
(
'<h2>'
.
$settings
[
0
]
.
'</h2>'
,
'Block "'
.
$settings
[
0
]
.
'" is in place.'
);
$position
[
$weight
]
=
strpos
(
$test_content
,
$settings
[
0
]);
}
$this
->
assertTrue
(
$position
[
0
]
<
$position
[
1
],
'The blocks are rendered in the correct order.'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment