Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Admin
UI::process_bulk_actions()
Processes actions that can be applied in bulk (requests to delete, enable or disable).
Метод класса: UI{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->process_bulk_actions( $ids, $action );
- $ids(int[]) (обязательный)
- The ID(s) to be updates.
- $action(строка) (обязательный)
- The action to be applied.
Код UI::process_bulk_actions() UI::process bulk actions WC 9.3.3
private function process_bulk_actions( array $ids, string $action ) { $deletes = 0; $enabled = 0; $disabled = 0; $register = wc_get_container()->get( Register::class ); foreach ( $ids as $id ) { if ( 'delete' === $action && $register->delete_by_id( $id ) ) { $deletes++; } elseif ( 'enable' === $action && $register->enable_by_id( $id ) ) { $enabled++; } elseif ( 'disable' === $action && $register->disable_by_id( $id ) ) { $disabled ++; } } $fails = count( $ids ) - $deletes - $enabled - $disabled; $redirect = $this->table->get_base_url(); if ( $deletes ) { $redirect = add_query_arg( 'deleted-ids', $deletes, $redirect ); } elseif ( $enabled ) { $redirect = add_query_arg( 'enabled-ids', $enabled, $redirect ); } elseif ( $disabled ) { $redirect = add_query_arg( 'disabled-ids', $disabled, $redirect ); } if ( $fails ) { $redirect = add_query_arg( 'bulk-fails', $fails, $redirect ); } wp_safe_redirect( $redirect ); exit; }