cms icon indicating copy to clipboard operation
cms copied to clipboard

[5.x] Support fieldsets in subdirectories

Open duncanmcclean opened this issue 2 years ago • 7 comments

This pull request adds support for creating & managing fieldsets located in subdirectories. This was already kinda possible but there was a few rough edges, which this PR sorts out.

One of the rough edges was the fact you couldn't previously create a fieldset in a subdirectory in the Control Panel, you had to go in and manually create the file.

This PR fixes that so you can create fieldsets in subdirectories, using this syntax: components.team_members

Another change I've made is that fieldsets in subdirectories will be split out into separate groups on the Fieldsets Index page, like we do for namespaced fieldsets.

Here's an example of what that looks like (the "My Fieldsets" group will always be displayed first):

CleanShot 2024-01-17 at 11 38 34

One last thing I had to fix was deleting fieldsets. Previously, the FieldsetRepository@delete method was manually constructing the file path and it wasn't replacing . with /. I've adjusted this to use the fieldset's path instead which takes this into account.


Closes #3178. Closes statamic/ideas#915.

duncanmcclean avatar Jan 17 '24 11:01 duncanmcclean

Hey @duncanmcclean, this is a great PR! Curious if there are plans to merge this in the near-ish future?

We're using nested fieldsets in a project, and it actually seems to work for the most part, but CP access is broken (ie, throws a Undefined array key "type" in FieldTransformer::referenceFieldToVue() when trying to edit—or a create a new—fieldset. Thinking this PR might resolve that issue.

caseydwyer avatar Mar 21 '24 13:03 caseydwyer

Sorry, we don't have an ETA for reviewing/merging this pull request. We'll get to it when we can.

In the meantime, you can pull this PR into your project with a composer patch.

duncanmcclean avatar Mar 21 '24 14:03 duncanmcclean

No problem and no rush, just thought I'd check—thanks Duncan, appreciate the update!

caseydwyer avatar Mar 22 '24 13:03 caseydwyer