Automattic\WooCommerce\Admin\API

Leaderboards::get_item_schema()publicWC 1.0

Get the schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

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

Код Leaderboards::get_item_schema() WC 8.7.0

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'leaderboard',
		'type'       => 'object',
		'properties' => array(
			'id'      => array(
				'type'        => 'string',
				'description' => __( 'Leaderboard ID.', 'woocommerce' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'label'   => array(
				'type'        => 'string',
				'description' => __( 'Displayed title for the leaderboard.', 'woocommerce' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'headers' => array(
				'type'        => 'array',
				'description' => __( 'Table headers.', 'woocommerce' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
				'items'       => array(
					'type'       => 'array',
					'properties' => array(
						'label' => array(
							'description' => __( 'Table column header.', 'woocommerce' ),
							'type'        => 'string',
							'context'     => array( 'view', 'edit' ),
							'readonly'    => true,
						),
					),
				),
			),
			'rows'    => array(
				'type'        => 'array',
				'description' => __( 'Table rows.', 'woocommerce' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
				'items'       => array(
					'type'       => 'array',
					'properties' => array(
						'display' => array(
							'description' => __( 'Table cell display.', 'woocommerce' ),
							'type'        => 'string',
							'context'     => array( 'view', 'edit' ),
							'readonly'    => true,
						),
						'value'   => array(
							'description' => __( 'Table cell value.', 'woocommerce' ),
							'type'        => 'string',
							'context'     => array( 'view', 'edit' ),
							'readonly'    => true,
						),
					),
				),
			),
		),
	);

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