Automattic\WooCommerce\Admin\API

OnboardingThemes::register_routes()publicWC 1.0

Register routes.

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

Хуков нет.

Возвращает

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

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

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

Код OnboardingThemes::register_routes() WC 8.7.0

public function register_routes() {
	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/install',
		array(
			array(
				'methods'             => \WP_REST_Server::EDITABLE,
				'callback'            => array( $this, 'install_theme' ),
				'permission_callback' => array( $this, 'update_item_permissions_check' ),
			),
			'schema' => array( $this, 'get_item_schema' ),
		)
	);

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/activate',
		array(
			array(
				'methods'             => \WP_REST_Server::EDITABLE,
				'callback'            => array( $this, 'activate_theme' ),
				'permission_callback' => array( $this, 'update_item_permissions_check' ),
			),
			'schema' => array( $this, 'get_item_schema' ),
		)
	);

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/recommended',
		array(
			'methods'             => 'GET',
			'callback'            => array( $this, 'get_recommended_themes' ),
			'permission_callback' => array( $this, 'get_item_permissions_check' ),
			'args'                => array(
				'industry' => array(
					'type'        => 'string',
					'description' => 'Limits the results to themes relevant for this industry (optional)',
				),
				'currency' => array(
					'type'        => 'string',
					'enum'        => array( 'USD', 'AUD', 'CAD', 'EUR', 'GBP' ),
					'default'     => 'USD',
					'description' => 'Returns pricing in this currency (optional, default: USD)',
				),
			),
			'schema'              => array( $this, 'get_recommended_item_schema' ),
		)
	);
}