I use a lot of nested Field Collections with cardinality set to unlimited (which works great!), but it would be awesome to have the ability to collapse each instance of the field collection when using the embedded layout.

Collapsing would allow for easier drag-and-drop reordering and make the editing panel a lot easier to visually process (being able to "close up" the field collections not being edited at that moment would certainly cut down on confusion).

I guess a side request of this feature would be the ability of the field collection's label to take on the name of the value of the first field, so when collapsed, it would be visually distinct from other instances of the collapsed field collections. However, I'd be more than happy with just "Field Collection 1, Field Collection 2."

Comments

hixster’s picture

any progress on this , I just stumbled across a need for this too

jpcurley25’s picture

Agreed... complex content types with many field collections is very hard to follow making it easy to mistakenly enter data incorrectly.

j4’s picture

Would also love to have this facility

Thanks
Jaya

node9’s picture

+1

Where do we start?

hbalagtas’s picture

Another +1

I have a fairly complex nested field and this feature would help so much.

Anonymous’s picture

likewise (+1)

I'll give it a shot whenever I find the time.

idflood’s picture

I need this for a project too. I will probably go for a custom js but here are some remarks:

  1. Doing it 100% in js is not a problem since drag/drop reordering will not work without it.
  2. Maybe at first do a really simple solution with simply the "field-collection-1", ... as @thirdboxcar mentioned
  3. I think the best way to handle all situations would be to add a "preview" view mode to field collection if possible. With this it would allow to have custom layout for collapsed field collection.

Any other idea of how to handle the flexibility needed for a complete solution?

andrew.croce’s picture

I'd like to add my support for this feature request. Field Collections is a fantastic module, but it can become rather unwieldy when there are many nested fields.
Thanks

dman’s picture

Interesting idea.
With the items becoming themable #1157794: Move markup to template files and improve theming in new 2.x branch you may be in a good position to override the rendering as needed.
But I would suggest waiting for that patch to land before trying to develop this just yet.

I can see a number of ways that the fieldgroup options and style could be re-purposed to this. (imagine accordion on it)

andrew.croce’s picture

Indeed, I have discovered that using fieldgroups works perfectly for this. You can quite easily create nested accordion groups/items, and out your field collections in there. Thanks for the suggestion dman.

zulfierken’s picture

Any update?

aendra’s picture

+1 on what dman said in #9 and andrew.croce said in #10 -- I'm using Field Groups to accomplish this and they work great.

While it *would* be nice to have folding/accordioning/etc. as a native feature in Field Collections, I can see this only happening if the community steps up to do it -- which, given as there's a fairly robust workaround (And much more pressing bugs in the Field Collection issue queue), I'm not exactly holding my breath.

(That said, definitely willing to review/test any patches someone releases on this issue.)

jfrederick’s picture

StatusFileSize
new8.68 KB

I understand this issue is a low priority, but I want to mention that Inline Entity Form has a UI I believe would work excellently for Field Collection. Each field collection could be, by default, collapsed into one table row. When you click Edit on a table row, it would then expand. I believe IEF uses Ajax to then load the edit form, but I think Ajax or simple JS hiding/showing would be fine.

dman’s picture

I like the look of #13 as a UI alternative

aimeerae’s picture

EDIT - just saw #9 and they also had this idea and I jumped to the end (sorry :-/). It is a functional workaround while a more robust solution is set up. :-)

Thank you jfrederick! RE #13 - it is a great idea! I'm using inline entity form on other parts of the site but also using field collections (different use cases). Since I don't have much background extending field collections / forms, I'm not sure if there are gotchas in that method. Any feelings from the maintainers on this?

This issue thread got me thinking (thank you!). Just for giggles, check out this collapsible fieldset hack. Using an accordion grouping helps shrink the complex field collection sections I use for generic article and page types. It did the job of consolidating the sections into more manageable sections. I'm not yet sure what it may do to my other displays, but it helps deal with the ability to rearrange the unlimited field collections on the node form.

I even left one of the fields out so people have visibility into the fieldset contents. :-)

field-collection-collapsable-fieldset-hack.png

andypost’s picture

There's a project application #2012796: [D7] Field Collection Fieldset
Suppose collapsible widget could be implemented in the proposed module as addition to formatter

zestagio’s picture

#2012796: [D7] Field Collection Fieldset
Hi, I wrote a module that implements formatter to display the Field Collections as a fieldset. I plan to implement the widget in the future

zestagio’s picture

I finished a module Field Collection Fieldset and now it provides a widget "Fieldset" for field_collection fields.

thirdboxcar’s picture

Issue summary: View changes

@zestiago, I finally hopped back onto this thread after starting it two years ago...your widget is exactly what I wanted! Thank you!!

mxh’s picture

Isnt it possible to use the Field Group module for this case?

kopeboy’s picture

The problem is that the embedded field collection already IS a fieldset.

So for example if I want to use the (field group's) accordions I will have the field collection nested with double title :(

The field collection fieldset module currently has some bugs.. the relevant one being it cannot start the fieldset as collapsed :(

j_s’s picture

I just ran into this issue, and #18 works perfectly for my needs! Thanks so much zestagio!

watergate’s picture

Thanks zestagio, works perfectly!

xoruna’s picture

Status: Active » Fixed

I think we can mark this as fixed. More bugs about this should be reported to the Field Collection Fieldset module page. Or maybe using the Field Group and Display Suite instead.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.