Bulk actions + Extra data
- fixed issue on bulk action being run even without any items selected - added WP like feature regarding item selection, if all items are checked, it also checks the header/footer checkboxes - fixed issue where the selection state was not properly reset - added List column to subscribers - added json_encode/json_decode to Twig
This commit is contained in:
@@ -27,7 +27,21 @@ class Subscribers {
|
||||
\Model::factory('\MailPoet\Models\Subscriber'),
|
||||
$data
|
||||
);
|
||||
wp_send_json($listing->get());
|
||||
|
||||
|
||||
$listing_data = $listing->get();
|
||||
|
||||
// fetch segments relations for each returned item
|
||||
foreach($listing_data['items'] as &$item) {
|
||||
$segments = SubscriberSegment::select('segment_id')
|
||||
->where('subscriber_id', $item['id'])
|
||||
->findMany();
|
||||
$item['segments'] = array_map(function($relation) {
|
||||
return $relation->segment_id;
|
||||
}, $segments);
|
||||
}
|
||||
|
||||
wp_send_json($listing_data);
|
||||
}
|
||||
|
||||
function getAll() {
|
||||
|
Reference in New Issue
Block a user