kirby
kirby copied to clipboard
Options field 'preview' does not accept per-user permissions
Description
According to the page blueprint reference
Each option can be set on a per user role for fine-grained permissions
However, when I set
options:
preview:
admin: true
editor: false
The panel throws the following error:
Kirby\Cms\Page::previewUrl(): Return value must be of type ?string, array returned
The panel apparently expects either a boolean or a template string but no array of users, like the other options do.
Expected behavior
Either make the behavior consistent with the other options or change the reference documentation to reflect this inconsistency. This should affect supplying different template strings for different users as well.
Your setup
Kirby Version
3.6
@getkirby/kirby-staff Do you think is it an intended, a bug, or an improvement that needs to be made?
Also note that preview can be a string. I'm not sure how it can be disabled for both string and some roles. Applicable for non-string values, but seems difficult for string values.
I agree that ideally there should be a way to set different values per role, e.g. like this:
options:
preview:
admin: true
editor: "{{ page.parent.url }}/#{{ page.slug }}"
translator: false
The options are unfortunately inconsistent at the moment. E.g. there is also the changeTemplate option that supports an array, however not an array of roles but an array of target templates.
I think this is something to reconsider after the upcoming blueprint refactoring.
Good to know. In the meantime, I believe the documentation should be updated to reflect the two exceptions. As currently written, one would expect all options to behave in a consistent manner. No major issue, but I ran into it and it's an unnecessary annoyance when you're new to Kirby and learning from documentation.
You are absolutely right. I've updated the docs.
This issue has been automatically marked as stale because it has not had recent activity. This is for us to prioritize issues that are still relevant to our community. It will be closed if no further activity occurs within the next 14 days. If this issue is still relevant to you, please leave a comment.