I have a feed where one element is to be mapped to a multiselect
field on an entry. However, I would need to tweak the values I'm importing (basically making them lowercase), to match the values of my multiselect field in Craft (I would rather map to value than label, although even if I mapped to labels, I would need to do some changes to the imported values).
I've tried more or less every event that FeedMe offers me (and some I've found in the code that are not in the docs), but I cannot find any that seems to do the trick.
I tried to use EVENT_BEFORE_PARSE_FIELD
, which seemed to be a logical point (though the event is not mentioned in the docs), but as it doesn't actually set the values changed in the event back to the values passed in (as it does with other events), the changes are simply lost. So no luck.
On my last try, I tried using EVENT_STEP_BEFORE_ELEMENT_SAVE
, and changing the $contentData
. But, as far as I can see, this variable is not passed in to the actual save function, it's just passed to an aftersave
function, that for entries seems to do absolutely nothing.
So, short of having to loop through the entire feed, searching for the attribute in question in every node, and changing each of them, I can't see how to achieve this. It would make sense to be able to tweak the values passed in at some point where the code is handling one node, but I can't seem to find it.
If anyone have any ideas, I would really appreciate it.