Register wccom-site rest in main class.
With API moved to its own package (see #23957), controllers for wccom- site namespace are now registered in wccom-site main class.
This commit is contained in:
parent
5756766a03
commit
40201eb9c3
|
@ -23,6 +23,7 @@ class WC_WCCOM_Site {
|
|||
self::includes();
|
||||
|
||||
add_action( 'woocommerce_wccom_install_products', array( 'WC_WCCOM_Site_Installer', 'install' ) );
|
||||
add_action( 'woocommerce_rest_api_get_rest_namespaces', array( __CLASS__, 'register_rest_namespace' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,6 +33,23 @@ class WC_WCCOM_Site {
|
|||
require_once( WC_ABSPATH . 'includes/admin/helper/class-wc-helper.php' );
|
||||
require_once( __DIR__ . '/class-wc-wccom-site-installer.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register wccom-site REST namespace.
|
||||
*
|
||||
* @param array $namespaces List of registered namespaces.
|
||||
*
|
||||
* @return array Registered namespaces.
|
||||
*/
|
||||
public static function register_rest_namespace( $namespaces ) {
|
||||
require_once( __DIR__ . '/rest-api/v1/class-wc-rest-wccom-site-installer-v1-controller.php' );
|
||||
|
||||
$namespaces['wccom-site/v1'] = array(
|
||||
'installer' => 'WC_REST_WCCOM_Site_Installer_V1_Controller',
|
||||
);
|
||||
|
||||
return $namespaces;
|
||||
}
|
||||
}
|
||||
|
||||
WC_WCCOM_Site::load();
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
*
|
||||
* Handles requests to /installer.
|
||||
*
|
||||
* @package WooCommerce/API
|
||||
* @package WooCommerce/WCCOM_Site/REST_API
|
||||
* @since 3.7.0
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* REST API WCCOM Site Installer Controller Class.
|
||||
* REST API WCCOM Site Installer v1 Controller Class.
|
||||
*
|
||||
* @package WooCommerce/API
|
||||
* @package WooCommerce/WCCOM_Site/REST_API
|
||||
* @extends WC_REST_Controller
|
||||
*/
|
||||
class WC_REST_WCCOM_Site_Installer_Controller extends WC_REST_Controller {
|
||||
class WC_REST_WCCOM_Site_Installer_V1_Controller extends WC_REST_Controller {
|
||||
|
||||
/**
|
||||
* Endpoint namespace.
|
Loading…
Reference in New Issue