How do I save the selected structure as yaml? I want to render the structure fields separately in my template.
The default value seems to be the index of the item in the original structure field, which is a bit strange to me (because changes to that list invalidate all saved values in the dependent select field).
To clarify: I want to be able to render ...->lastnames() and ->firstnames() independently. AutoID would still require me to loop through the $site->authors() field any time I want to render these in a template, which seems a bit inefficient.
Yes, but in most cases the reason to use a select field and query options from somewhere is to make a relation, so when the relation doesn’t exists anymore because it was deleted, then you probably don’t want to output anything. But that depends on use case, of course. An author will still be an author, even if they are deleted later.
But the select field can’t store/read stuff in yaml format, so in order to do so, you would have to create a custom field. Or you just store lastname and firstname as string. Why do you want to store the information in yaml format?