statamic / v2-docs

Statamic v2 Documentation
https://v2.statamic.com
54 stars 133 forks source link

Publish forms doc #463

Open miloslavkostir opened 4 years ago

miloslavkostir commented 4 years ago

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:...)

  2. 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.