Automattic\WooCommerce\Admin\API

OnboardingPlugins::get_install_activate_schema()publicWC 1.0

JSON Schema for install-and-activate endpoint.

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

Хуков нет.

Возвращает

Массив.

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

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

Код OnboardingPlugins::get_install_activate_schema() WC 9.4.2

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,
			),
		),
	);
}