Commit 01bb1268 authored by alexpott's avatar alexpott
Browse files

Issue #2306611 by rbayliss: Fixed Field weights are not respected on render.

parent aeb6df2a
......@@ -275,7 +275,7 @@ public function buildMultiple(array $build_list) {
// taken care of in EntityViewDisplay::buildMultiple().
foreach ($display->getComponents() as $name => $options) {
if (isset($build_list[$key][$name])) {
$build_list[$key]['#weight'] = $options['weight'];
$build_list[$key][$name]['#weight'] = $options['weight'];
}
}
......
......@@ -153,6 +153,24 @@ public function testEntityViewBuilderCacheToggling() {
$this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == array('tags'), 'An entity type can opt out of render caching regardless of view mode configuration, but always has cache tags set.');
}
/**
* Tests weighting of display components.
*/
public function testEntityViewBuilderWeight() {
// Set a weight for the label component.
entity_get_display('entity_test', 'entity_test', 'full')
->setComponent('label', array('weight' => 20))
->save();
// Create and build a test entity.
$entity_test = $this->createTestEntity('entity_test');
$view = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
drupal_render($view);
// Check that the weight is respected.
$this->assertEqual($view['label']['#weight'], 20, 'The weight of a display component is respected.');
}
/**
* Creates an entity for testing.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment