Skip to content
Snippets Groups Projects
Commit d234ff8e authored by catch's avatar catch
Browse files

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

parent f0d3dcfa
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment