Automattic\WooCommerce\Internal\Admin\Settings

PaymentsRestController::get_schema_for_suggestion()privateWC 1.0

Get the schema for a suggestion.

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

Хуков нет.

Возвращает

Массив. The schema for a suggestion.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_schema_for_suggestion(): array;

Код PaymentsRestController::get_schema_for_suggestion() WC 9.6.1

private function get_schema_for_suggestion(): array {
	return array(
		'type'        => 'object',
		'description' => esc_html__( 'A suggestion with full details.', 'woocommerce' ),
		'context'     => array( 'view', 'edit' ),
		'readonly'    => true,
		'properties'  => array(
			'id'          => array(
				'type'        => 'string',
				'description' => esc_html__( 'The unique identifier for the suggestion.', 'woocommerce' ),
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'_priority'   => array(
				'type'        => 'integer',
				'description' => esc_html__( 'The priority of the suggestion.', 'woocommerce' ),
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'_type'       => array(
				'type'        => 'string',
				'description' => esc_html__( 'The type of the suggestion.', 'woocommerce' ),
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'title'       => array(
				'type'        => 'string',
				'description' => esc_html__( 'The title of the suggestion.', 'woocommerce' ),
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'description' => array(
				'type'        => 'string',
				'description' => esc_html__( 'The description of the suggestion.', 'woocommerce' ),
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'plugin'      => array(
				'type'       => 'object',
				'context'    => array( 'view', 'edit' ),
				'readonly'   => true,
				'properties' => array(
					'_type'  => array(
						'type'        => 'string',
						'enum'        => array( PaymentProviders::EXTENSION_TYPE_WPORG ),
						'description' => esc_html__( 'The type of the plugin.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
					'slug'   => array(
						'type'        => 'string',
						'description' => esc_html__( 'The slug of the plugin.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
					'status' => array(
						'type'        => 'string',
						'enum'        => array(
							PaymentProviders::EXTENSION_NOT_INSTALLED,
							PaymentProviders::EXTENSION_INSTALLED,
							PaymentProviders::EXTENSION_ACTIVE,
						),
						'description' => esc_html__( 'The status of the plugin.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
				),
			),
			'image'       => array(
				'type'        => 'string',
				'description' => esc_html__( 'The URL of the image.', 'woocommerce' ),
				'readonly'    => true,
			),
			'icon'        => array(
				'type'        => 'string',
				'description' => esc_html__( 'The URL of the icon (square aspect ratio).', 'woocommerce' ),
				'readonly'    => true,
			),
			'links'       => array(
				'type'     => 'array',
				'context'  => array( 'view', 'edit' ),
				'readonly' => true,
				'items'    => array(
					'type'       => 'object',
					'properties' => array(
						'_type' => array(
							'type'        => 'string',
							'description' => esc_html__( 'The type of the link.', 'woocommerce' ),
							'context'     => array( 'view', 'edit' ),
							'readonly'    => true,
						),
						'url'   => array(
							'type'        => 'string',
							'description' => esc_html__( 'The URL of the link.', 'woocommerce' ),
							'context'     => array( 'view', 'edit' ),
							'readonly'    => true,
						),
					),
				),
			),
			'tags'        => array(
				'description' => esc_html__( 'The tags associated with the suggestion.', 'woocommerce' ),
				'type'        => 'array',
				'uniqueItems' => true,
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
				'items'       => array(
					'type'        => 'string',
					'description' => esc_html__( 'The tags associated with the suggestion.', 'woocommerce' ),
					'readonly'    => true,
				),
			),
			'category'    => array(
				'type'        => 'string',
				'description' => esc_html__( 'The category of the suggestion.', 'woocommerce' ),
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
		),
	);
}