Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291890

Add optional sorting method for sequences

$
0
0

Problem/Motivation

Sequences in a config schema are used for many things and they can define if they should be ordered by key or value. Unfortunately, however, most sequences do not specify a sorting order.
For some sequences there is already an order defined in the config entity class which can not easily be translated to order by key or value. Another such sequence is the module in core.extension.

In order to allow sequences to be sorted the way they are we need to be able to specify a sorting method.

Proposed resolution

Add a new key to sequences config schema: order_method (name tbd)
It can be a static method on a class (or any callable representable as a string and always available or autoloadable) and should take an array by reference as an argument.
When this property is set the method is used to sort the sequence.

Remaining tasks

Decide on what to name the key in the config schema.
Decide on the signature of the method (ie take an array by reference or return an array)
Find a good candidate sequence to use it with. (everything else will be in their own issue.)
Implement and test
document it

User interface changes

none

API changes

new option to sort sequences by. Backwards compatible as older versions of drupal will just ignore it.

Data model changes

none

Release notes snippet

A custom method can be specified in the config schema to sort sequences.


Viewing all articles
Browse latest Browse all 291890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>