Handlers can be re ordered ok in the UI etc... when they are loaded, they keep their order. The problem is when they are saved. Currently views relies on the order of the handlers as their weighting; However, now we are using the config system, the display options are passed through ksort(). The offender is in Drupal\Core\Comnfig\Config.php:
public function sortByKey(array &$data) {
ksort($data);
foreach ($data as &$value) {
if (is_array($value)) {
$this->sortByKey($value);
}
}
}
So, either #1785560: Remove the sorting of configuration keys gets committed or we implement a 'weight' key on each handler and run each handler options array through drupal_sort_weight()?
Here are some tests that show this, currently failing behaviour.
Comment | File | Size | Author |
---|---|---|---|
#8 | 1798026-8.patch | 2.94 KB | damiankloip |
#2 | views-1798026-2.patch | 2.12 KB | dawehner |
views-handler-weights-tests.patch | 2.88 KB | damiankloip | |
Comments
Comment #2
dawehnerWhat about something like that?
Comment #4
dawehnerThis is basically blocked by #1792860: Move procedural code from views_ui.module and admin.inc to ViewUI
Comment #5
aspilicious CreditAttribution: aspilicious commentedNo more blocked, but I would move the search function to a static class function and call it here if possible. See uasort($categories, 'Drupal\Core\Config\Entity\ConfigEntityBase::sort');
in this core patch: #1588422: Convert contact categories to configuration system
Comment #6
aspilicious CreditAttribution: aspilicious commentedIn fact that sort function is just the thing we need :)
http://drupalcode.org/project/drupal.git/blob/refs/heads/8.x:/core/lib/D...
Comment #7
damiankloip CreditAttribution: damiankloip commentedI personally think we should just wait for the linked issue in the summary to get in :) Then commit the tests at the top, as they should then pass.
Comment #8
damiankloip CreditAttribution: damiankloip commentedRe rolled and postponing on issue in summary.
Comment #9
tim.plunkett#1785560: Remove the sorting of configuration keys went in
Comment #10
dawehnerPerfect!
Comment #11
tim.plunkettCommitted!
http://drupalcode.org/project/views.git/commit/f3dda39
Comment #12.0
(not verified) CreditAttribution: commentedUpdated issue summary.