How can I sort Labels in config entity list builder? I have a very simple config entity with a few fields. In the list builder I want to sort the label field by creation date rather than by alphabetical order.

I originally thought this should be fairly easy, but it's proving way more difficult than I expected.

Can anybody point me in the right direction?
To answer my own question I guess.

Config entities list builder extends the ConfigEntityListBuilder class,
which comes with a few built in methods, among which

  /**
   * Loads entity IDs using a pager sorted by the entity id.
   *
   * @return array
   *   An array of entity IDs.
   */
  protected function getEntityIds() {
    $query = $this-&gt;getStorage()-&gt;getQuery()
      -&gt;sort($this-&gt;entityType-&gt;getKey('id'));

    // Only add the pager if a limit is specified.
    if ($this-&gt;limit) {
      $query-&gt;pager($this-&gt;limit);
    }
    return $query-&gt;execute();
  }


To sort, in whichever you ones desires, the display list itself all that needs to be done is overwrite the function in the child class.

In my case it was something like this:

protected function getEntityIds() {
  $query = $this
    -&gt;getStorage()
    -&gt;getQuery()
    -&gt;sort('notification_creation_date', 'DESC');

  // Only add the pager if a limit is specified.
  if ($this-&gt;limit) {
    $query-&gt;pager($this-&gt;limit);
  }
  return $query-&gt;execute();
}