statamic / workshop

Create and edit entries, pages, and globals on the front-end of your site without the control panel.
https://statamic.com/marketplace/addons/workshop
3 stars 2 forks source link

Can't set fieldset to created collection entries #27

Closed mar627 closed 5 years ago

mar627 commented 5 years ago

Describe the bug The line with the fieldset specification fieldset: event is not present in the workshop entries md file. According to docs I can specify fieldset in the workshop:entry:create tag like so (at least I think):

{{ workshop:entry:create collection="events" fieldset="event" }}
   ...
{{ /workshop:entry:create }}

Expected behavior

---
title: 'Workshop entry title'
id: dc8b0518-021b-46a0-a503-4f9c26fcb660
fieldset: event
---
Workshop entry content

Above is what I'd expect, but instead the md file for the new entry has no fieldset specified, why does it not pick up the parameter in the workshop tag?

danielfowler commented 5 years ago

You are right - the docs on https://statamic.com/marketplace/addons/workshop/docs say you can have a fieldset parameter. It doesn't say the fieldset value is going to be saved in your entry data; that's what your form inputs are for. It's meant to define the fieldset against which your Workshop form should be submitted.

In other words, a Workshop form will only save input fields from your form if they appear in the fieldset of the collection you're submitting, as defined in the folder.yaml. Defining a fieldset parameter isn't saving it as a variable but rather telling Workshop to use a [different] fieldset than whatever is defined in your folder.yaml.

If you have a fieldset defined in your folder.yaml, you don't need the parameter in your Workshop tag.

If you need to define a fieldset variable, you should add an HTML input to your form.

mar627 commented 5 years ago

Thanks Daniel. Cleared that right up for me! I tried using workshop to create pages (opposed to entries) that used a particular fieldset, but couldn't figure out where to specify it. However, specifying it as you suggested in yaml for a collection folder, and using workshop to create entries, works perfectly.

Cheers!