Writing custom fields to Structure object worked in K2, but doesn't in K3

Ok, I think I now made sense of it all and figured out the actual problem:

Kirby 3 has changed its internal workings in a way that

  • if you use the toStructure() method, you receive a Structure object, that is in itself a collection of so called structureObject objects
  • if you use the toGroup() method you receive a Collection object, which is a collection of Structure() objects which are a collection of StructureObject objects

That all makes sense so far, I guess, they just redefined the type of objects.

The problem now is, that the Structure object apparently was changed in a way that I cannot write custom fields to it anymore (as it is just supposed to only hold StructureObject objects). And the problem with this is, that this makes it impossible for me to easily sort the groups (or Structure objects actually) within a Collection with the sortBy() method.

In Kirby 2 I could just assign a custom field to any Structure object within a collection and then sort the Structure objects in this collection by this custom field.

I think I will open an issue about this on GitHub. If somebody has any idea how to solve this another way, I am all ears.