With Kirky docs: Advanced > Custom field methods > The field object:
##The field object
$field object gives you access to three important attributes.
$field->key - The name of the field
$field->value - The raw content of the field
$field->page - The parent
we can get some informations of a panel field in a snippet or a template. That is fine.
Please add something like
$field->label to get the (translated) label of the field, if it is an Radiobuttons field , then I want to have the label of the choosen item.
The difference here is that $field->key() and $field->value() exist in the text file, whereas the field labels or the radio button / select / checkbox “labels” only exist in the blueprint files.
So that to get these values, Kirby would have to read the blueprints on top of the text files.
Ok, that is an difference.
But with something like
$field->label we don’t need to develop the same two times:
- in the blueprints
- in the snippets/templates
and always with the same wording, even with subsequent modifications.
Yeah that would definitely be an advantage. Being able to use the same wording instead of having to repeat everythig manually could be a huge advantage. Like the idea.
+1 for this
$field->$blueprint->$label to make it clear where it is sourced from?