From f8b73e73151f7650456a3351d379ae13fce89b60 Mon Sep 17 00:00:00 2001 From: migueldamota Date: Tue, 21 Nov 2023 15:32:19 +0100 Subject: [PATCH 1/2] feat: use pre initialized classes for bulk action handlers --- src/Admin/Admin.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Admin/Admin.php b/src/Admin/Admin.php index 55a8f99e..6b2e27a1 100644 --- a/src/Admin/Admin.php +++ b/src/Admin/Admin.php @@ -1553,6 +1553,12 @@ public static function get_bulk_action_handlers() { ); foreach ( $handlers as $key => $handler ) { + + if ( is_object( $handler ) && is_a( $handler, get_class( $handler ) ) ) { + self::$bulk_handlers[ $key ] = $handler; + continue; + } + self::$bulk_handlers[ $key ] = new $handler(); } } From 8669a9fbbb7a487271595eae7b091fca6dd6d8f5 Mon Sep 17 00:00:00 2001 From: migueldamota Date: Tue, 21 Nov 2023 16:28:08 +0100 Subject: [PATCH 2/2] fix: use correct type for `is_a` check --- src/Admin/Admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/Admin.php b/src/Admin/Admin.php index 6b2e27a1..359e09dd 100644 --- a/src/Admin/Admin.php +++ b/src/Admin/Admin.php @@ -1554,7 +1554,7 @@ public static function get_bulk_action_handlers() { foreach ( $handlers as $key => $handler ) { - if ( is_object( $handler ) && is_a( $handler, get_class( $handler ) ) ) { + if ( is_object( $handler ) && is_a( $handler, 'Vendidero\Germanized\Shipments\Admin\BulkActionHandler' ) ) { self::$bulk_handlers[ $key ] = $handler; continue; }