Commit d234ff8e authored by catch's avatar catch

Issue #1888688 by tim.plunkett: Allow list controller sorting to be overridden.

parent f0d3dcfa
......@@ -20,7 +20,7 @@ class ConfigEntityListController extends EntityListController {
*/
public function load() {
$entities = parent::load();
uasort($entities, 'Drupal\Core\Config\Entity\ConfigEntityBase::sort');
uasort($entities, array($this->entityInfo['class'], 'sort'));
return $entities;
}
......
......@@ -145,6 +145,9 @@ function testListUI() {
$edit = array('label' => 'Antelope', 'id' => 'antelope');
$this->drupalPost(NULL, $edit, t('Save'));
// Ensure that the entity's sort method was called.
$this->assertTrue(state()->get('config_entity_sort'), 'ConfigTest::sort() was called.');
// Confirm that the user is returned to the listing, and verify that the
// text of the label and machine name appears in the list (versus elsewhere
// on the page).
......
......@@ -84,4 +84,12 @@ public function getExportProperties() {
return $properties;
}
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::sort().
*/
public static function sort($a, $b) {
state()->set('config_entity_sort', TRUE);
return parent::sort($a, $b);
}
}
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