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.
When there is only 1 field collection item is not necesary to show "Remove" button, that button should appear only if there is 2 or more field collection items...
for ux reasons is not logic have a "Remove" button if the item is still gonna be there. if you click the button the item stays there...
Comment | File | Size | Author |
---|---|---|---|
#3 | do not show remove button.diff | 267 bytes | vivekguptakota |
field_collection_1_item.png | 9.63 KB | ssoulless |
Comments
Comment #1
jmuzz CreditAttribution: jmuzz commentedIt should be there as long as there is data in the field collection item's fields. I agree it isn't necessary if the field collection item is blank as nothing will be saved and there is nothing to remove.
Comment #2
ssoulless CreditAttribution: ssoulless commentedComment #3
vivekguptakota CreditAttribution: vivekguptakota commentedYou can apply following patch
field_collection/field_collection.module
Line no 1421
-- if ($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED) {
++ if ($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED && $field_state['items_count']>1) {
Add one more condition with items_count.After made this change remove button will not show when only one item present in field collection
Comment #4
Chris Matthews CreditAttribution: Chris Matthews commented@vivekguptakota, can you upload a .patch file against the latest 7.x-1.x-dev?