FR: Add possibility to enhance matching of elements with custom logic #903
Unanswered
kristiansp
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
It would be great to have the possibility of adding custom logic to how FeedMe matches elements. What I would like to do is to perform some additional tests, and based on them decide whether FeedMe should go on adding, deleting, updating, etc. the element.
I could picture it being useful both before FeedMe does the matching (i.e. skip the item for consideration), and to do some additional logic when FeedMe has found a match.
One example is a cinema program feed I have, where I normally would like to update upcoming events, and delete those who are no longer in the feed. But I would like to keep the ones today, even if they are technically in the past (and thus are no longer in my feed).
I'm not sure my thoughts on implementation are the best, but what I am picturing is that it could be possible through events. What I'm thinking is that the
EVENT_STEP_BEFORE_ELEMENT_MATCH
event could include a flag that could be set to false, to effectively not continue with the matching (kind of like the$skipUpdateFieldHandle
).For another use case I'm picturing an added
EVENT_STEP_AFTER_ELEMENT_MATCH
. It would then be useful to be able to access both the aforementioned flag, as well as the actual matched Craft element in the event to do some custom comparison between the feed data and the element after FeedMe has done its matching.I guess another way could to somehow be able to register some extra rules, that FeedMe would take into account, but I'm then getting a bit out of my depth, so I don't know exactly how that would work in practice, and which method makes more sense.
Hopefully I'm making some sense trying to describe this.
Steps to reproduce
Additional info
Beta Was this translation helpful? Give feedback.
All reactions