Automattic\WooCommerce\Internal\DataStores\Orders

CustomOrdersTableController::get_settings()publicWC 1.0

Method of the class: CustomOrdersTableController{}

No Hooks.

Return

null. Nothing (null).

Usage

$CustomOrdersTableController = new CustomOrdersTableController();
$CustomOrdersTableController->if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET[foo] ?? fooo ) ), foooo ) );
! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET[foo] ?? fooo ) ) (required)
-
foooo ) (required)
-

CustomOrdersTableController::get_settings() code WC 8.7.0

if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ?? '' ) ), 'hpos-sync-now' ) ) {
	WC_Admin_Settings::add_error( esc_html__( 'Unable to start synchronization. The link you followed may have expired.', 'woocommerce' ) );
	return;
}

$this->data_cleanup->toggle_flag( false );
$this->batch_processing_controller->enqueue_processor( DataSynchronizer::class );
	}

	/**
	 * Tell WP Admin to remove the sync query arg from the URL.
	 *
	 * @param array $query_args The query args that are removable.
	 *
	 * @return array
	 */
	private function register_removable_query_arg( $query_args ) {
$query_args[] = self::SYNC_QUERY_ARG;

return $query_args;
	}

	/**
	 * Handler for the woocommerce_after_register_post_type post,
	 * registers the post type for placeholder orders.
	 *
	 * @return void
	 */
	private function register_post_type_for_order_placeholders(): void {
wc_register_order_type(
	DataSynchronizer::PLACEHOLDER_ORDER_POST_TYPE,
	array(
		'public'                           => false,
		'exclude_from_search'              => true,
		'publicly_queryable'               => false,
		'show_ui'                          => false,
		'show_in_menu'                     => false,
		'show_in_nav_menus'                => false,
		'show_in_admin_bar'                => false,
		'show_in_rest'                     => false,
		'rewrite'                          => false,
		'query_var'                        => false,
		'can_export'                       => false,
		'supports'                         => array(),
		'capabilities'                     => array(),
		'exclude_from_order_count'         => true,
		'exclude_from_order_views'         => true,
		'exclude_from_order_reports'       => true,
		'exclude_from_order_sales_reports' => true,
	)
);
	}

	/**
	 * Add the definition for the HPOS feature.
	 *
	 * @param FeaturesController $features_controller The instance of FeaturesController.
	 *
	 * @return void
	 */
	private function add_feature_definition( $features_controller ) {
$definition = array(
	'option_key'          => self::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION,
	'is_experimental'     => false,
	'enabled_by_default'  => false,
	'order'               => 50,
	'setting'             => $this->get_hpos_setting_for_feature(),
	'additional_settings' => array(
		$this->get_hpos_setting_for_sync(),
	),
);

$features_controller->add_feature_definition(
	'custom_order_tables',
	__( 'High-Performance order storage', 'woocommerce' ),
	$definition
);
	}

	/**
	 * Returns the HPOS setting for rendering HPOS vs Post setting block in Features section of the settings page.
	 *
	 * @return array Feature setting object.
	 */
	private function get_hpos_setting_for_feature() {
if ( 'yes' === get_transient( 'wc_installing' ) ) {
	return array();
}

$get_value = function() {
	return $this->custom_orders_table_usage_is_enabled() ? 'yes' : 'no';
};

/**
 * ⚠️The FeaturesController instance must only be accessed from within the callback functions. Otherwise it
 * gets called while it's still being instantiated and creates and endless loop.
 */

$get_desc = function() {
	$plugin_compatibility = $this->features_controller->get_compatible_plugins_for_feature( 'custom_order_tables', true );

	return $this->plugin_util->generate_incompatible_plugin_feature_warning( 'custom_order_tables', $plugin_compatibility );