Sorting pages in section according to a dynamic value

I’ve got a parent page (called collection) with children (called entries). The collection page has a select field called sortOrder with a series of sort values (title_asc, title_desc, published_asc, published_desc, …). The selected value is used to order the entries in the frontend, which works as expected.

In the panel, however, I would like the entries in the pages section to be sorted the same way. I’ve tried various things, but I can’t make it work. The section to list the active entries looks like this:

type: pages
sortBy: "{{ page.sortBy }}"
sortable: "{{ page.sortable }}"
templates:
  - entry

Where the the collection’s model adds the required methods:

class CollectionPage extends Page {
  public function sortBy() {
    if ($this->sortOrder()->value() == 'manual') return null;

    return str_replace('_', ' ', $this->sortOrder()->value());
  }

  public function sortable() {
    return $this->sortOrder()->value() == 'manual';
  }
}

Unfortunately, it looks like those values are not evaluated as a variable. Only when sortBy is configured as a string (e.g. title desc) , it has some effect.

But even if it would work, another smaller problem is presenting itself (I think). In case the sortOrder in the collection is configured to be manual, the value for sortBy in the section should be set to null, but that probably will be a string because it’s interpolated as a string, or am I wrong?

Is there any way around the issue? I don’t mind writing a local plugin, but I’d need some pointers.