Download the PHP package art-and-flywork/kirby.plugin.fieldset without Composer
On this page you can find all versions of the php package art-and-flywork/kirby.plugin.fieldset. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download art-and-flywork/kirby.plugin.fieldset
More information about art-and-flywork/kirby.plugin.fieldset
Files in art-and-flywork/kirby.plugin.fieldset
Package kirby.plugin.fieldset
Short Description Panel field which loads a fieldset and stores the values in a single field as yaml
License MIT
Informations about the package kirby.plugin.fieldset
Fieldset
Panel field which loads a fieldset and stores the values in a single field as yaml.
This works like an extend with the difference that all all values from the fieldset fields are store in a single field. This way you van reuse the fieldset and bind it to a snippet: snippet('mySnippet', $page->the_fieldset()->yaml())
Usage
Create a blueprint with a fieldset:
site/blueprints/fieldsets/somefields.yml
the type: group
is not mandatory for this plugin to work, but it will make it work as a standard kirby field extend too when needed.
In your page yml add the fieldset field and point it to the fieldset blueprint:
site/blueprints/pages/default.yml
In the panel the fields from somefields.yml are loaded in the fieldset field:
The data is stored as yml in the txt file:
Using the values in templates
There are 2 ways to easily access the values stored in the fieldset field. There is a supplied chainable method or it's yaml can be decoded with the native yaml method or even passed
1. Using the supplied fieldmethod
The plugin introduces a field method to make the values accessible as regular chainable kirby fields:
2. Yaml decode by hand
In the template the data is accessible as array by yaml decoding it:
default.php
Once decoded the values can be directly passed to a snippet:
site/snippets/mySnippet.php
License
[MIT