-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Enhances filters evaluation for DWCs #13226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@Syrgak-Alan Can you please add an example to the description of how the new filter could look in the subscriber? It would help test this pull request. |
@kuzmany if I understood you correctly, how namely I wrote evaluation for extended filter which subscribes the event? Or how I added this filter to the list of options |
@Syrgak-Alan we need part of the code that will test it. Simple subscriber what add new filter and provide it in result. It can be whatever, you can create just another contact email filter. |
@kuzmany I provided a snippet of code, which evaluates extended filter |
@Syrgak-Alan where can I find that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this PR as requirement for https://github.com/Leuchtfeuer/mautic-DwcDeviceType-bundle - looks good from user-perpective! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my side it does not need these kind of changes.
You can use your own filters validation on your https://github.com/Leuchtfeuer/mautic-DwcDeviceType-bundle/blob/main/EventListener/DynamicContentSubscriber.php
And other filters (not related to your added filters) you can use validation from trait app/bundles/EmailBundle/EventListener/MatchFilterForLeadTrait.php
Something like
foreach ($filters as $key=>$filter) {
if ('device_type' === $filter['type']) {
// your logic determine results, not passed return false
// $event->setIsEvaluated(true);
// $event->setIsMatched(false);
// return;
// unset custom filters
unset(filters[$key])
}
}
// if your custom filters validation passed, then continue rest of filters validate with regular expressions
$event->setIsEvaluated(true);
$event->setIsMatched($this->matchFilterForLead($filters, $leadArray));
What do you mean by From my side it does not need these kind of changes? |
@kuzmany I've took over this task. The PR actually solves the problem: in the method In addition i found that the DWC stats are not properly creating stats entry: I would propose two different solutions:
|
Closing in favore of #14599. Please test that one as it has tests and passing CI. |
Description:
Leuchtfeuer.com
This enhancement will allow to add another filters for your dynamic web content by listening to DynamicContentEvents::ON_CONTACTS_FILTER_EVALUATE event. To add new filter, subscriber of wished filter has to listen to Mautic\LeadBundle\LeadEvents::LIST_FILTERS_CHOICES_ON_GENERATE event and store a choice in LeadListFiltersChoicesEvent, in LeadBundle\EventListener\FilterOperatorSubscriber is an example how could it be implemented.
(this enhancement works for this moment only for landing pages. I want firstly get some feedback, if PR is good I will commit changes for email bundle too)
As requested, here is an example how could be used such enhancement:
In this plugin is possible to filter DWC by device type of page's visitor:
https://github.com/Leuchtfeuer/mautic-DwcDeviceType-bundle
Steps to test this:
Steps to test this PR: