Automattic\WooCommerce\Internal\DataStores\Orders
CustomOrdersTableController::add_hpos_tools()
Add an entry to Status - Tools to create or regenerate the custom orders table, and also an entry to delete the table as appropriate.
Метод класса: CustomOrdersTableController{}
Хуков нет.
Возвращает
Массив
. The updated array of tools.
Использование
$CustomOrdersTableController = new CustomOrdersTableController(); $CustomOrdersTableController->add_hpos_tools( $tools_array ): array;
- $tools_array(массив) (обязательный)
- The array of tools to add the tool to.
Код CustomOrdersTableController::add_hpos_tools() CustomOrdersTableController::add hpos tools WC 9.7.1
public function add_hpos_tools( array $tools_array ): array { if ( ! $this->data_synchronizer->check_orders_table_exists() ) { return $tools_array; } // Cleanup tool. $tools_array = array_merge( $tools_array, $this->data_cleanup->get_tools_entries() ); // Delete HPOS tables tool. if ( $this->custom_orders_table_usage_is_enabled() || $this->data_synchronizer->data_sync_is_enabled() ) { $disabled = true; $message = __( 'This will delete the custom orders tables. The tables can be deleted only if the "High-Performance order storage" is not authoritative and sync is disabled (via Settings > Advanced > Features).', 'woocommerce' ); } else { $disabled = false; $message = __( 'This will delete the custom orders tables. To create them again enable the "High-Performance order storage" feature (via Settings > Advanced > Features).', 'woocommerce' ); } $tools_array['delete_custom_orders_table'] = array( 'name' => __( 'Delete the custom orders tables', 'woocommerce' ), 'desc' => sprintf( '<strong class="red">%1$s</strong> %2$s', __( 'Note:', 'woocommerce' ), $message ), 'requires_refresh' => true, 'callback' => function () { $this->features_controller->change_feature_enable( self::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION, false ); $this->delete_custom_orders_tables(); return __( 'Custom orders tables have been deleted.', 'woocommerce' ); }, 'button' => __( 'Delete', 'woocommerce' ), 'disabled' => $disabled, ); return $tools_array; }