ideas
ideas copied to clipboard
Blueprints: validate keys/names of tabs/columns/fields
One of the biggest and most frustrating moments is when I use disallowed/unsupported name for my fields. It doesn't happen often, but it does happen occasionally and it's superfrustrating to deal with.
Struggling with the query language … Is it possible to query for a files field? Something like:
query: page.image.toFile()
orquery: page.image.first.toFile()
Renaming the field fromimage
toimg
solved it :no_mouth: —(example from Slack:)
~~If validation is "too much dev time(TM)", perhaps prominent section of docs related to blueprints could be designated for a list of reserved/problematic words.~~
My bad. The notice is here: https://getkirby.com/docs/guide/blueprints/fields#naming-fields
Thank you.
ran into the same problem earlier. would appreciate this!
This is super difficult to solve. The issue haunts us since Kirby 1 and there is no good solution:
- We cannot display an error in the Panel for these fields as the fields themselves are completely valid, they only cannot be accessed directly in templates.
- When a method like
$page->image()
is called, it doesn't know whether the developer actually wanted to access a field.
Possible solutions are:
- a list of field names that have this problem – that already exists as the list of
$page
methods in the reference - changing the docs to use
->content()
everywhere as that will always work, however the syntax is longer and not required for most fields - a more prominent warning in the docs in more places
A true solution in the core is very difficult for the mentioned reasons.
I know the idea of a health check plugin has been floating around for a while... that certainly would be one good check to cover in such a plugin (loop through all field names and check against method list).