v2-docs icon indicating copy to clipboard operation
v2-docs copied to clipboard

Publish forms doc

Open miloslavkostir opened this issue 5 years ago • 0 comments

There is wrong or poor documentation in example here https://docs.statamic.com/addons/publish-forms#example

  1. The <publish fieldset="..."> doesn't work This code:
<publish ...
    fieldset="{{ $fieldset->toPublishArray() }}"
...
></publish>

throws:
ErrorException in helpers.php line 469: htmlentities() expects parameter 1 to be string, array given (View:...)

  1. There is no explanation how to set addon's custom fieldset: Path to fieldset: site/addons/MyAddon/fieldsets/my_fieldset.yaml I was able to find in Statamic\CP\Fieldset how to define fieldsets's (path)name:
private function prepareData($data)
{
    return $this->preProcessWithBlankFields(Fieldset::get('MyAddon.fieldsets/my_fieldset', 'addon'), $data);
}

But I'm not able to define this fieldset in view. Code bellow doesn't work:

<publish ...
    fieldset-name="MyAddon.fieldsets/my_fieldset" <!-- use either fieldset-name or fieldset props. not both -->
...
></publish>

Conclusion: If I'm creating publish form I'm creating addon too. But according to the documentation I can't use addon's fieldset. I must define fieldset in default /site/settings/fieldsets.

miloslavkostir avatar Feb 07 '20 12:02 miloslavkostir