kirby-plugin-custom-add-fields
kirby-plugin-custom-add-fields copied to clipboard
Syntax suggestions and extensions
I really love this extension to fine-tune and tailor the create dialogs inside the panel. But when using custom add fields in our blueprints the syntax always looked a bit "hackish" to me:
addFields: # where?
__dialog: # is this a field, too?
skip: true
forcedTemplate: remote
title: # no, this is a field?
type: text
label: Title
First, addFields doesn't really explain where these fields will be added. Second, having a blueprint property prefixed like __dialog is nothing I've seen in other places within Kirby's blueprints. What about changing the syntax so something more aligned to the default section and field setup?
dialog: # this is what we want to adjust
skip: true
forcedTemplate: remote
fields: # this is how sections or structure fields start field listings
title:
type: text
label: Title
Referencing existing fields
A common situation we face in our blueprints is replicating fields in the dialog that are already defined in the blueprint itself. It would be helpful, if the plugin allowed for referenced field options. For example, this setup would add the title and date fields:
# General definitions
fields:
title:
label: Title
type: text
date:
label: Date
type: date
# Dialog settings
dialog:
fields:
- title
- date
Setting field defaults
Another situation we often have to solve via models is generating page titles based on other field values because we obmit the title field from the dialog. It would be cool to automate this using Kirby's query language:
dialog:
defaults:
title: 'Entry on {{ page.date.toDate('Y-m-d') }}'
fields:
date:
type: date
label: Date
Depending on the given fields in the dialog, this could of course be using for other field values but the title.
I'm really thankful for this extension ❤️ and I don't expect anything to be included short-term. But maybe, if you'll update this extension in the future, these suggestions might be interesting to consider.
Hi @nilshoerrmann ,
thanks a lot for these suggestions and inputs. I very appreciate!
During October, I will have some time to work on the plugin again. Plans are to make it compatible with Kirby 3.6. In that context, I will certainly consider these suggestions.
@steirico, if you'd consider these syntax suggestions it could be interesting to make a clear cut with Kirby 3.6 because the inplementation will have to change fundamentally: you could phase out this plugin and keep it for compatibility reasons and create a new one, e. g. kirby-dialogs-extended, using the new methodology and naming scheme. This would sharpen the focus of the plugin even more.