Automattic\WooCommerce\RestApi
Server::get_rest_namespaces
Get API namespaces - new namespaces should be registered here.
Метод класса: Server{}
Хуки из метода
Возвращает
Массив. List of Namespaces and Main controller classes.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_rest_namespaces();
Код Server::get_rest_namespaces() Server::get rest namespaces WC 10.7.0
protected function get_rest_namespaces() {
$namespaces = array(
'wc/v1' => wc_rest_should_load_namespace( 'wc/v1' ) ? $this->get_v1_controllers() : array(),
'wc/v2' => wc_rest_should_load_namespace( 'wc/v2' ) ? $this->get_v2_controllers() : array(),
'wc/v3' => wc_rest_should_load_namespace( 'wc/v3' ) ? $this->get_v3_controllers() : array(),
'wc-telemetry' => wc_rest_should_load_namespace( 'wc-telemetry' ) ? $this->get_telemetry_controllers() : array(),
);
if ( wc_rest_should_load_namespace( 'wc/v4' ) && Features::is_enabled( 'rest-api-v4' ) ) {
$namespaces['wc/v4'] = $this->get_v4_controllers();
}
/**
* Filter the list of REST API controllers to load.
*
* @since 4.5.0
* @param array $controllers List of $namespace => $controllers to load.
*/
return apply_filters( 'woocommerce_rest_api_get_rest_namespaces', $namespaces );
}