Automattic\WooCommerce\Admin\RemoteInboxNotifications
RemoteInboxNotificationsEngine::add_debug_tools()
Add the debug tools to the WooCommerce debug tools (WooCommerce > Status > Tools).
Метод класса: RemoteInboxNotificationsEngine{}
Хуков нет.
Возвращает
Разное
.
Использование
$result = RemoteInboxNotificationsEngine::add_debug_tools( $tools );
- $tools(массив) (обязательный)
- a list of tools.
Код RemoteInboxNotificationsEngine::add_debug_tools() RemoteInboxNotificationsEngine::add debug tools WC 9.3.3
private static function add_debug_tools( $tools ) { // Check if the feature flag is disabled. if ( ! Features::is_enabled( 'remote-inbox-notifications' ) ) { return false; } // Check if the site has opted out of marketplace suggestions. if ( get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) !== 'yes' ) { return false; } $tools['refresh_remote_inbox_notifications'] = array( 'name' => __( 'Refresh Remote Inbox Notifications', 'woocommerce' ), 'button' => __( 'Refresh', 'woocommerce' ), 'desc' => __( 'This will refresh the remote inbox notifications', 'woocommerce' ), 'callback' => function () { RemoteInboxNotificationsDataSourcePoller::get_instance()->read_specs_from_data_sources(); RemoteInboxNotificationsEngine::run(); return __( 'Remote inbox notifications have been refreshed', 'woocommerce' ); }, ); $tools['delete_inbox_notification'] = array( 'name' => __( 'Delete an Inbox Notification', 'woocommerce' ), 'button' => __( 'Delete', 'woocommerce' ), 'desc' => __( 'This will delete an inbox notification by slug', 'woocommerce' ), 'selector' => array( 'description' => __( 'Select an inbox notification to delete:', 'woocommerce' ), 'class' => 'wc-product-search', 'search_action' => 'woocommerce_json_inbox_notifications_search', 'name' => 'delete_inbox_notification_note_id', 'placeholder' => esc_attr__( 'Search for an inbox notification…', 'woocommerce' ), ), 'callback' => function () { check_ajax_referer( 'debug_action', '_wpnonce' ); if ( ! isset( $_GET['delete_inbox_notification_note_id'] ) ) { return __( 'No inbox notification selected', 'woocommerce' ); } $note_id = wc_clean( sanitize_text_field( wp_unslash( $_GET['delete_inbox_notification_note_id'] ) ) ); $note = Notes::get_note( $note_id ); if ( ! $note ) { return __( 'Inbox notification not found', 'woocommerce' ); } $note->delete( true ); return __( 'Inbox notification has been deleted', 'woocommerce' ); }, ); return $tools; }