I have basic understanding of php and having a problem.
Want to create a plugin to show structured fields.
The structured field located in ‘products.yml’, works great in the panel.
With the plugin I want to call the structured fields from the ‘products’ in markdown using the tag ‘(shopping-hero:)’
I created a plugin using the cookbook.
So far I can get everything from the ‘products’ but not the individual structured fields.
<?php
Kirby::plugin('your/shopping-hero', [
'tags' => [
'shopping-hero' => [
'html' => function($tag) {
return '' . $tag->parent()->products() . '';
}]
]
]);
I am aware that this only returns the complete ‘products’ and not the individual structured fields within ‘products’. I have searched hours on the forums and tried to add functions $tag->toStructure(); etc. but haven found a working solution yet.
The structured fields in ‘products’ include ‘subtitle’, ‘tagline’, ‘shopprice’, etc.
Any assistance would be brilliant. Thank you.