Skip to content
This repository has been archived by the owner on Apr 5, 2018. It is now read-only.

Fix checkbox field when exporting users #30

Closed
wants to merge 1 commit into from
Closed

Fix checkbox field when exporting users #30

wants to merge 1 commit into from

Conversation

stuartswan
Copy link

Exporting users with checkbox field data resulted in a blank column
data, this commit exports checkbox data correctly.

Exporting users with checkbox field data resulted in a blank column
data, this commit exports checkbox data correctly.
@boboldehampsink
Copy link
Owner

I don't get this fix. Why foreach through $data when it is NOT an array?

@stuartswan
Copy link
Author

Good point, it still works for me, the data in the CMS appears as ["Item 1","Item 2"] so already in array format?

When I export using my fix it shows as Item 1, Item 2 which is the desired output.

Thanks

@boboldehampsink
Copy link
Owner

Can you dump $data, see if it's probably an ArrayCollection object or something the like?

@stuartswan
Copy link
Author

Here is the dump of the $data:

object(Craft\MultiOptionsFieldData)#484 (2) { ["_options":"Craft\MultiOptionsFieldData":private]=> array(4) { [0]=> object(Craft\OptionData)#507 (3) { ["label"]=> string(1) "A" ["value"]=> string(1) "A" ["selected"]=> bool(false) } [1]=> object(Craft\OptionData)#510 (3) { ["label"]=> string(1) "B" ["value"]=> string(1) "B" ["selected"]=> bool(false) } [2]=> object(Craft\OptionData)#509 (3) { ["label"]=> string(1) "C" ["value"]=> string(1) "C" ["selected"]=> bool(false) } [3]=> object(Craft\OptionData)#519 (3) { ["label"]=> string(1) "D" ["value"]=> string(1) "D" ["selected"]=> bool(false) } } ["storage":"ArrayObject":private]=> array(0) { } }

Last part mentions storage as ArrayObject so perhaps this is what you're after?

Thanks

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants