Refactor mailpoet_subscribers_in_segment_apply_bulk_action_handlers to direct calls

[MAILPOET-3077]
This commit is contained in:
Rostislav Wolny
2020-09-14 17:08:39 +02:00
committed by Veljko V
parent a42b3d6e3f
commit bf053edbfb
5 changed files with 14 additions and 129 deletions

View File

@@ -2,7 +2,6 @@
namespace MailPoet\DynamicSegments;
use MailPoet\DynamicSegments\FreePluginConnectors\SubscribersBulkActionHandler;
use MailPoet\DynamicSegments\Mappers\DBMapper;
use MailPoet\DynamicSegments\Persistence\Loading\SingleSegmentLoader;
use MailPoet\WP\Functions as WPFunctions;
@@ -16,22 +15,12 @@ class DynamicSegmentHooks {
}
public function init() {
$this->wp->addAction(
'mailpoet_subscribers_in_segment_apply_bulk_action_handlers',
[$this, 'applySubscriberBulkAction']
);
$this->wp->addAction(
'mailpoet_get_segment_filters',
[$this, 'getSegmentFilters']
);
}
public function applySubscriberBulkAction(array $handlers) {
$handlers[] = new SubscribersBulkActionHandler();
return $handlers;
}
public function getSegmentFilters($segmentId) {
$singleSegmentLoader = new SingleSegmentLoader(new DBMapper());
return $singleSegmentLoader->load($segmentId)->getFilters();