Merge pull request #11668 from woothemes/add/wc-api-loading-hooks

Add a new hook and filter for loading new REST API files.
This commit is contained in:
Justin Shreve 2016-08-10 06:30:26 -07:00 committed by GitHub
commit dd0ddac577
1 changed files with 4 additions and 2 deletions

View File

@ -174,6 +174,8 @@ class WC_API extends WC_Legacy_API {
include_once( dirname( __FILE__ ) . '/api/class-wc-rest-webhooks-controller.php' );
include_once( dirname( __FILE__ ) . '/api/class-wc-rest-system-status-controller.php' );
include_once( dirname( __FILE__ ) . '/api/class-wc-rest-system-status-tools-controller.php' );
do_action( 'woocommerce_api_includes' );
}
/**
@ -184,7 +186,7 @@ class WC_API extends WC_Legacy_API {
// Register settings to the REST API.
$this->register_wp_admin_settings();
$controllers = array(
$controllers = apply_filters( 'woocommerce_api_controllers', array(
'WC_REST_Coupons_Controller',
'WC_REST_Customer_Downloads_Controller',
'WC_REST_Customers_Controller',
@ -212,7 +214,7 @@ class WC_API extends WC_Legacy_API {
'WC_REST_Webhooks_Controller',
'WC_REST_System_Status_Controller',
'WC_REST_System_Status_Tools_Controller',
);
) );
foreach ( $controllers as $controller ) {
$this->$controller = new $controller();