statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
30 stars 1 forks source link

Sections in fieldsets #988

Open jacksleight opened 1 year ago

jacksleight commented 1 year ago

It'd be great if you could create sections inside fieldsets. One use case is defining a set of SEO fields along with a section title and description all in one place, and then importing the whole thing into multiple blueprints.

Until now I've used the section fieldtype at the top of a fieldset, and that still works. But I get the impression the idea is to migrate from the section fieldtype to sections now they exist (and also the styling doesn't match so it looks a bit off alongside actual sections).

jacksleight commented 1 year ago

On second thought I guess that wouldn't work as you'd be adding sections to sections then, unless there's a clever way to solve that.

Maybe using the section fieldtype is still the best approach when using fieldsets?

jasonvarga commented 1 year ago

Yeah a little oversight.

I could see letting you create sections in a fieldset, and then in the blueprint you could import it at the top level, as a sibling to sections.

If you were to import it within a blueprint section, it could flatten all the fieldset's fields so you don't end up with nested sections.

For example, take this fieldset:

Fieldset
  Section A
    - Field One
    - Field Two
  Section B
    - Field Three
If you import the fieldset at the top level... ``` Blueprint Section A - Field Four Import Fieldset Section B - Field Five ``` You could end up with a form like this: ``` Blueprint Section A - Field Four Fieldset Section A - Field One - Field Two Fieldset Section B - Field Three Blueprint Section B - Field Five ```
If you import the fieldset within a section... ``` Blueprint Section A - Field Four - Import Fieldset Section B - Field Five ``` You could end up with a form like this: ``` Blueprint Section A - Field Four - Field One - Field Two - Field Three Blueprint Section B - Field Five ```
jacksleight commented 1 year ago

I could see letting you create sections in a fieldset, and then in the blueprint you could import it at the top level, as a sibling to sections. If you were to import it within a blueprint section, it could flatten all the fieldset's fields so you don't end up with nested sections.

Oh yeah that would be great, best of both worlds then!