Automattic\WooCommerce\Admin\API

OnboardingPlugins::get_install_activate_schema()publicWC 1.0

JSON Schema for install-and-activate endpoint.

Method of the class: OnboardingPlugins{}

No Hooks.

Return

Array.

Usage

$OnboardingPlugins = new OnboardingPlugins();
$OnboardingPlugins->get_install_activate_schema();

OnboardingPlugins::get_install_activate_schema() code WC 9.0.1

public function get_install_activate_schema() {
	$error_schema = array(
		'type'              => 'object',
		'patternProperties' => array(
			'^.*$' => array(
				'type' => 'string',
			),
		),
		'items'             => array(
			'type' => 'string',
		),
	);

	$install_schema = array(
		'type'       => 'object',
		'properties' => array(
			'installed' => array(
				'type'  => 'array',
				'items' => array(
					'type' => 'string',
				),
			),
			'results'   => array(
				'type'  => 'array',
				'items' => array(
					'type' => 'string',
				),
			),
			'errors'    => array(
				'type'       => 'object',
				'properties' => array(
					'errors'     => $error_schema,
					'error_data' => $error_schema,
				),
			),
		),
	);

	$activate_schema = array(
		'type'       => 'object',
		'properties' => array(
			'activated' => array(
				'type'  => 'array',
				'items' => array(
					'type' => 'string',
				),
			),
			'active'    => array(
				'type'  => 'array',
				'items' => array(
					'type' => 'string',
				),
			),
			'errors'    => array(
				'type'       => 'object',
				'properties' => array(
					'errors'     => $error_schema,
					'error_data' => $error_schema,
				),
			),
		),
	);

	return array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'Install and Activate Schema',
		'type'       => 'object',
		'properties' => array(
			'type'       => 'object',
			'properties' => array(
				'install'  => $install_schema,
				'activate' => $activate_schema,
			),
		),
	);
}