E.g. all default
options, labels etc.
See original issue: https://github.com/getkirby/kirby/issues/2814
I’d appreciate this getting more attention. For example, this use-case would be quite neat:
author:
type: select
label:
*: user
default: "{{kirby.user}}"
options:
type: query
query: kirby.users
This could be a select-field that defaults to the current user when a new page is created. It doesn’t work right now.
@Wenzel The select field default
option already hsa query support. However, you need to provide an actual value matching your options. With your query consisting of user objects, those will be resolved to the username as text and the email as value (https://github.com/getkirby/kirby/blob/main/src/Option/OptionsQuery.php#L109). Your default query must then also resolve to an email address. Right now your query points to a user object - the string representation of a user object will be the user id, not user email.
It does work for me with default: "{{ kirby.user.email }}"
(make sure it’s correctly indented - in your pasted example the default
option is inside the label
option not on the same level as it should be.
Then again, why do you not want to use the users field with default: true
which does provide the functionality you describe out of the box?
I did not check to see if a users field existed, and obviously its the better option. Thanks :)