I followed the guide to create a field preview in a structure.
Following code does however not show a preview. What am I doing wrong?
template: '<p>Demo field</p>'
template: '<p>Demo field preview</p>'
Hm, just tested your example and works for me.
What’s your Kirby version?
sorry, . it’s Kirby 3.9.4, of course
will I have to register the props in PHP, as well?
I only have this:
'fields' => [
'myfield' => 
Should be suffcient for the test, since you are not using any props in your field; but if you add props to the demo field, they need to be registered in the php file, yes.
then I’m puzzled.
Are you using different versions? I updated Kirby to the main branch but without success.
Will try PHP 8.1 later. I will have to upload it to another server for that.
Haha, me too. Hm, can’t remember what I did, but turns out that the preview is empty when the field to preview has no value.
OK, cool. Sorry, it’s not clear to me how to provide a (fake) value.
Would you mind pasting you working example?
What I really want is to add a button so the user can download a generated QR-code.
When I tested this, I added a value in the content file. You can automate this by setting a default value. I don’t know if there is a way to fake a value.