WC_REST_WCCOM_Site_Installer_Controller::register_routes()publicWC 7.7.0

Register the routes for plugin auto-installer.

Метод класса: WC_REST_WCCOM_Site_Installer_Controller{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_REST_WCCOM_Site_Installer_Controller = new WC_REST_WCCOM_Site_Installer_Controller();
$WC_REST_WCCOM_Site_Installer_Controller->register_routes();

Список изменений

С версии 7.7.0 Введена.

Код WC_REST_WCCOM_Site_Installer_Controller::register_routes() WC 8.7.0

public function register_routes() {

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base,
		array(
			array(
				'methods'             => WP_REST_Server::EDITABLE,
				'callback'            => array( $this, 'install' ),
				'permission_callback' => array( $this, 'check_permission' ),
				'args'                => array(
					'product-id'      => array(
						'required' => true,
						'type'     => 'integer',
					),
					'run-until-step'  => array(
						'required' => true,
						'type'     => 'string',
						'enum'     => WC_WCCOM_Site_Installation_Manager::STEPS,
					),
					'idempotency-key' => array(
						'required' => true,
						'type'     => 'string',
					),
				),
			),
		)
	);

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/reset',
		array(
			array(
				'methods'             => WP_REST_Server::EDITABLE,
				'callback'            => array( $this, 'reset_install' ),
				'permission_callback' => array( $this, 'check_permission' ),
				'args'                => array(
					'product-id'      => array(
						'required' => true,
						'type'     => 'integer',
					),
					'idempotency-key' => array(
						'required' => true,
						'type'     => 'string',
					),
				),
			),
		)
	);
}