WC_REST_Payment_Gateways_V2_Controller::get_item_schema()publicWC 1.0

Get the payment gateway schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

$WC_REST_Payment_Gateways_V2_Controller = new WC_REST_Payment_Gateways_V2_Controller();
$WC_REST_Payment_Gateways_V2_Controller->get_item_schema();

Код WC_REST_Payment_Gateways_V2_Controller::get_item_schema() WC 8.7.0

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'payment_gateway',
		'type'       => 'object',
		'properties' => array(
			'id'                 => array(
				'description' => __( 'Payment gateway ID.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'title'              => array(
				'description' => __( 'Payment gateway title on checkout.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'description'        => array(
				'description' => __( 'Payment gateway description on checkout.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'order'              => array(
				'description' => __( 'Payment gateway sort order.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'arg_options' => array(
					'sanitize_callback' => 'absint',
				),
			),
			'enabled'            => array(
				'description' => __( 'Payment gateway enabled status.', 'woocommerce' ),
				'type'        => 'boolean',
				'context'     => array( 'view', 'edit' ),
			),
			'method_title'       => array(
				'description' => __( 'Payment gateway method title.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'method_description' => array(
				'description' => __( 'Payment gateway method description.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'settings'           => array(
				'description' => __( 'Payment gateway settings.', 'woocommerce' ),
				'type'        => 'object',
				'context'     => array( 'view', 'edit' ),
				'properties'  => array(
					'id'          => array(
						'description' => __( 'A unique identifier for the setting.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
					'label'       => array(
						'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
					'description' => array(
						'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
					'type'        => array(
						'description' => __( 'Type of setting.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit' ),
						'enum'        => array( 'text', 'email', 'number', 'color', 'password', 'textarea', 'select', 'multiselect', 'radio', 'image_width', 'checkbox' ),
						'readonly'    => true,
					),
					'value'       => array(
						'description' => __( 'Setting value.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit' ),
					),
					'default'     => array(
						'description' => __( 'Default value for the setting.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
					'tip'         => array(
						'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
					'placeholder' => array(
						'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
				),
			),
		),
	);

	return $this->add_additional_fields_schema( $schema );
}