Closed (fixed)
Project:
Field collection
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Sep 2012 at 19:20 UTC
Updated:
9 Aug 2016 at 18:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #0.0
RobW commentedAdded reference to the meta
Comment #1
coredumperror commentedI really need this functionality for my site, and I'd be more than happy to simply patch my local copy of field_collection to fix this issue, but I have no idea which section of code from the various patches on that page contains the removed prototype of this functionality. Could someone please point me in the right direction, so that I can patch field_collection to quiet the complaints from my users?
Comment #2
servantleader commentedAre this and related issues going to be addressed, or has development on this module been abandoned? Without fixing this, the module is only usefull for simple use cases (it is almost useless if you want a radio select without a N/A option). I would start writting the code myslef if I knew that it would be reviewed and commited, if not, I need to find a diferent solution than this module.
Comment #3
hhebert commentedIs there any development about this issue ?
Comment #4
coredumperror commentedI'm fairly sure that the underlying problem here was fixed in the December release (7.x-1.0-beta5), but I'm not positive. I remember being very happy to see that something related to this had changed for the better, but I can't recall what, exactly.
Comment #5
hhebert commentedWith the last version of Field_collection and Entity, I still have the problem of an empty field_collection show in my form when i have required fields instead of a "Add another" button only.
Comment #6
DaneMacaulay commentedattached adds setting to remove initial field collection form
Comment #7
tkbcreative commented@DaneMacaulay - thank you very much - your patch in #6 solved this issue for me
Comment #8
steven.wichers commentedFor single value collections the patch in #6 does not appear to do anything other than remove the field collection forms entirely.
Comment #8.0
steven.wichers commentedheaders
Comment #10
valentin schmid commentedPatch #6 solves the issue perfectelly. Patched against 7.x-1.0-beta7.
Thank you!
Comment #12
czigor commentedMaybe changing the default value to FALSE will make pass the tests. Also existing sites relying upon showing the first blank item won't break.
Comment #13
mlncn commentedFantastic work! This is a lifesaver. Going into production now (patched 7.x-1.x-dev and yes running that), hope it will be committed soon.
Comment #14
Adam Wood commentedThere are issues with using this patch with the Field Collection Node Clone module. When you clone a node with field collections using this patch, it will remove the first item in every field collection.
I haven't had a chance to look into it further yet, however I thought I'd flag it up. We just had to temporarily remove this functionality whilst cloning content.
Comment #15
gagarine commentedPatch #12 works perfectly. Thanks.
Comment #16
jmuzz commentedUse single quotes when possible for consistency with Drupal code standards and the rest of the module.
It should be singular since there will only be one initial item.
I think it needs a similar condition for hide blank items. The option doesn't make sense if hide blank items isn't checked so it shouldn't appear or work when it's not.
Capitals letters at the start and periods at the end please.
Comment #17
milos.kroulik commentedPatch from #12 doesn't apply to beta8 anymore.
Comment #18
czigor commentedIt applies to dev.
Comment #19
milos.kroulik commentedSorry, it seems to me, that latest dev is currently identical with beta 8:
http://cgit.drupalcode.org/field_collection/log/
Comment #20
czigor commentedHow are you trying to apply the patch? For me it applies without problem.
Comment #21
liquidcms commentedfrom original issue description i see:
would this suggest that when i am first creating a node which has a FC field with number of values = 1; i should see ONLY an "Add" button and no initial FC form? Even though the field setting states:
it sounds as though this would only apply for multivalued items. (and sure enough i do not get an Add button for my field but the single FC edit form as i used to get prior to patch)
i am not sure why we wouldn't want an Add button EVERY TIME when we state we want an Add button..
Comment #22
Nick Bell commentedApologies for amateurism, don't know how to propose a new patch properly (I have just attached mine) but patch #12 didn't work with 7.x-1.0-beta8+11-dev until I made the following tweak:
I'm not quite clear about the "hide blank item" vs "hide initial item" distinction but ticking both boxes achieves what I want.
Nick
Comment #23
Nick Bell commented(accidentally created comment - please delete)
Comment #24
chris burge commentedjmuzz posted some fixes that need to made when he changed the issue status to 'Needs Work'. The attached patch implements those fixes.
Comment #25
chris burge commentedRegarding the Field Collection Clone module, we can open an issue to address the issue described by #14 once this patch has been committed.
Comment #26
milos.kroulik commentedPatch in #24 seems to be working fine.
Comment #27
meecect commented#24 works, however, it would be nice if we had control of the button text. I use the custom add another module, which allows you to set the text that appears on the default 'add another' and 'remove' button. This module adds a third possibility, but we can't control the text. In my case, it's a form that is adding children, so my buttons normally say 'add another child', and 'remove child'.
When I enable this module, the button initially says 'Add another item', and then if i click it, I see the form for the blank item, but the button changes to 'add another child'.
Comment #28
chris burge commented@meecect - Have you tried using hook_form_alter?
Comment #29
logaritmisk commentedI hade issues that the first item was detected as empty, when it wasn't. This was only when host node was new (not saved yet).
It was an easy fix, I switched
!isset($form[$field_name][$element_langcode][0]['#entity']->item_id)tofield_collection_item_is_empty($form[$field_name][$element_langcode][0]['#entity'])Comment #30
milos.kroulik commented#27 seems to seems to be a regression. The patch shouldn't limit other modules.
Comment #31
chris burge commentedThe issue described by #27 is not a regression. The "Custom Add Another" module is a dependent module. Custom Add Another needs to account for the change made by this patch downstream when it implements hook_preprocess_field_multiple_value_form().
Comment #32
ashzade commentedThank you! Patch #29 with Custom Add Another is a great combination. The only issue I see that the "Order" column is shown until I add the first row.
Comment #33
mvlabat commentedApplying the previous patch breaks the field collection subfields which bave their (css/js) attachements.
You can test this, for instance, with Geofield and Addressfield Autocomplete combination.
To reproduce it you have to add a field collection containing geofield populated from Addressfield Autocomplete field.
This patch fixes this issue.
Comment #34
valentine94Looks nice to me. +1 to RTBC.
Comment #35
Max_Headroom commentedDoes the job. +1 RTBC
Comment #36
Max_Headroom commentedComment #38
jmuzz commentedThanks all. It's committed and will appear in the next dev version.
I also took the chance to change the wording on the help text for these options to try to make it more clear what the difference is.