Problem/Motivation
It's not possible to map a checkboxes to an Entity Reference field with cardinality unlimted. This seems to be a simple logic error in the MappingSteps.php. If the field is not repeatable, it only allows mapping to a FieldIntance where ->isMultiple() is false when in fact its perfectly valid to have this:

Map to an Entity Reference field for a taxonomy with cardinality unlimited.
Steps to reproduce
- Create a Taxonomy 'Themes'
- Create a GC checkboxes field 'Themes'
- Create an entity reference field to Themes from a content type with cardinality unlimited
- Go to mapping and attempt to map; No mapping options available
Proposed resolution
Patch coming
Remaining tasks
None
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | gathercontent-checkboxes-to-taxonomy-3200954-3.patch | 572 bytes | gdeni |
| #2 | gathercontent-checkboxes-to-taxonomy-3200954-2.patch | 619 bytes | scott_euser |
| checkboxes-field-in-gc.png | 32.27 KB | scott_euser |
Comments
Comment #2
scott_euser commentedComment #3
gdeni commentedThank you for reporting the issue! I think it would be better to add an extra condition to the else section to check the field type instead of removing it.
If we remove the else section, it will be possible to map single value Drupal fields with repeatable GatherContent fields, that may cause errors or unexpected behaviours.
I would rather check if the field is a text field, as currently only text fields can be repeatable in GatherContent. This way, checkbox fields (and all other non-text fields) could be mapped as before, but text fields only with the same cardinality.
Patch is attached, do you think this could work?
Comment #4
scott_euser commentedThat looks good to me, thanks!
Comment #6
gdeni commentedThanks! Then, I'm making a new release that contains the bug fixes you reported.
Comment #7
gdeni commented