- Issue created by @freelock
- 🇩🇪Germany jurgenhaas Gottmadingen
There is already a comment in the code at
\Drupal\eca_tamper\Plugin\Action\Tamper::execute
:// @todo We may want to call the validate and submit functions for the // tamper plugin so that they can update configuration based on final values // like e.g. required for the KeywordFilter plugin.
The tamper plugins have some unusual logic which uses the validate function of the configuration form to alter and otherwise prepare configuration of the plugin.
In the ECA context, we can't call that validation when saving the "configuration form", which in our case is the ECA model, because at that time we don't have the real data yet which will later be processed by ECA and the tamper plugin. To resolve this, we may have to call the validation just prior to execution. Unfortunately, at that point we don't have a form nor a form state object at hand and would have to build some on the fly.
Wish, there was a better way of doing this, e.g. if the tamper plugins were to provide a helper function that does the config pre-processing which could be called directly and likewise from validation. I may propose that in an issue in the tamper module.
- Status changed to Postponed: needs info
over 1 year ago 11:25am 2 June 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
Waiting for the related issue to be addressed.
- Status changed to Needs work
over 1 year ago 11:29am 14 June 2023 - 🇮🇹Italy kopeboy Milan
Actually I get the same error even if not using token substitutions in the "Words or phrases to filter on" but just a simple, fixed word string.
Notice that this instead works on feeds_tamper module (which I guess was the main usecase for which Tamper was created in the first place), so probably we should look there instead of tamper module itself on how to fix this base (much less useful than with tokens) case?At least this basic part could be considered a bug that needs work?
I'm attaching a simple ECA model to reproduce it.Note that it will always give this error, with any of the options "Respect word boundaries" or "Exact".
- 🇮🇹Italy kopeboy Milan
I leave this little documentation for others that might jump into this error:
a better alternative for an exact match filter might be to use the "List: Remove item" action (from eca_base module itself) with method "Drop by specified index key" or "Drop by specified value", where you can use token substitutions. That worked perfectly for the example usecase attached. - 🇩🇪Germany jurgenhaas Gottmadingen
Yes, this is not about using tokens, it's about how the upstream tamper plugin handles the config data. So, once the referenced issue is being addressed, it should work here as well.
- Status changed to Postponed: needs info
over 1 year ago 12:15pm 27 June 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
Setting back the status as we need to wait for the tamper module to fix the related issue.