Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There's an issue (with a patch) for Field Collection to completely hide empty collections. Since this module replaces the field collection widget, it needs its own patch to achieve this too.
Comment | File | Size | Author |
---|---|---|---|
#19 | hide_empty_collections-1653626-19.patch | 2.07 KB | nevergone |
#18 | hide_empty_collections-1653626-18.patch | 2.16 KB | gambry |
#12 | hide_empty_collections-1653626-12.patch | 2.15 KB | BWPanda |
Comments
Comment #1
BWPanda CreditAttribution: BWPanda commentedHere's the same code from the latest patch at the above issue applied to this module. Works for me (i.e. hides the collection label completely when the collection is empty).
Comment #2
glynster CreditAttribution: glynster commentedBWPanda I was wondering if you might be able to help me in my situation. I created a new case but have not had any feedback. Here it is for your reference: http://drupal.org/node/1708258
When I choose the "Table of field collection items" for the field I have the issue above in that the thead with labels is suddenly printed inside the tbody thus printing the labels when the table should actually not print. I applied your patch in the hope that this may have fixed the issue - but no luck.
Any ideas or solutions would be very helpful.
Comment #3
MichaelP CreditAttribution: MichaelP commentedThere was a typo in the patch ([elements] -> [element])
Rerolled.
Works ok for me, thanks @BWPanda
Comment #4
glynster CreditAttribution: glynster commentedOK makes all the difference.
I now see the option inside views and once applied it works like a charm.
Thanks for the re-roll.
Comment #5
BWPanda CreditAttribution: BWPanda commentedThanks for spotting that MichaelP!
Comment #6
rjdjohnston CreditAttribution: rjdjohnston commentedWorks beautifully! +1 for adding to core module.
Comment #7
NancyDruPatch failed and called out trailing whitespace.
Comment #8
Altcom_Alan CreditAttribution: Altcom_Alan commentedPatch in #3 worked for me on 7.x-1.0-beta1.
I've added the hide collection setting to the summary info.
Comment #9
robinmarshall CreditAttribution: robinmarshall commentedThanks, that works perfectly for me, look forward to seeing this in the release.
Comment #10
OFF CreditAttribution: OFF commentedPatches dont work for me.. I see empty collections titles.
Trying apply to stable release..
Comment #11
caw67 CreditAttribution: caw67 commentedpatch works
please commit!
Comment #12
BWPanda CreditAttribution: BWPanda commentedHere's an updated patch for the latest dev version.
Comment #13
glynster CreditAttribution: glynster commentedThanks @BWPanda any chance we can get this committed?
Comment #14
BWPanda CreditAttribution: BWPanda commentedA good first step would be testing and marking this issue as RTBC :)
Comment #15
glynster CreditAttribution: glynster commentedI committed this patch and works again just like before! RTBC
Comment #16
BWPanda CreditAttribution: BWPanda commentedComment #17
gambryJust to re-confirm: patch works perfectly and it would be good to have this pushed on next version, as having the label on the page when there are no items is quite annoying :( .
Thanks!
Comment #18
gambryActually to be correct a hook_field_formatter_view should always return the $element array(), in this case as empty.
The patch just swaps:
with
Comment #19
nevergone CreditAttribution: nevergone commentedPatch re-rolled and tested: works well!
Comment #21
kevineinarsson CreditAttribution: kevineinarsson at Websystem for ComplianceOnline Ltd commented