whitecube / nova-flexible-content

Flexible Content & Repeater Fields for Laravel Nova
MIT License
778 stars 230 forks source link

Fix remove files #496

Closed jeffcaulfield-morphsites closed 5 months ago

jeffcaulfield-morphsites commented 6 months ago

This is a cherry-pick of the changes from #291 (without all the reformatting)—in turn derived from #108—to make the "delete" button work on File fields in flexible layout sections.

wize-wiz commented 5 months ago

@jeffcaulfield-morphsites I have a few tiny questions ;)

Either I'm missing some files to look at or I'm missing the point of all these changes.

I'm not quite sure what the intend was here. I was searching for several methods to obtain a flat collection of fields fixing the dependsOn problem. I have to say honestly that FieldCollection::findFieldByAttribute and FieldCollection::flattenGroups are quite messy.

I would indeed applaud for a custom FieldCollection to flatten the layouts to obtain all fields.

jeffcaulfield-morphsites commented 5 months ago

@wize-wiz As mentioned in my original comment, this is a cherry-pick of the changes from an issue opened a long time ago to fix a specific problem related to File/Image fields in the context of a flexible content section. I tried to bring the changes forward more or less verbatim, only without the PSR reformatting "noise" of #291.

I'll have to look at this again later an see if I missed something during the cherry-pick operation. The changes definitely seemed to fix the "delete" problem on an earlier version of this component…

cc @flxsource

jeffcaulfield-morphsites commented 5 months ago

My apologies: I thought I'd tested this change but apparently I was mistaken. I'll withdraw this pull request and try again later.