Automattic\WooCommerce\Internal\Abilities\Domain
AbstractDomainAbility::get_collection_output_schema
Get a collection output schema.
Method of the class: AbstractDomainAbility{}
No Hooks.
Returns
Array.
Usage
$result = AbstractDomainAbility::get_collection_output_schema( $collection_key, $item_schema ): array;
- $collection_key(string) (required)
- Collection property key.
- $item_schema(array) (required)
- JSON schema describing a single item in the collection.
AbstractDomainAbility::get_collection_output_schema() AbstractDomainAbility::get collection output schema code WC 10.9.1
protected static function get_collection_output_schema( string $collection_key, array $item_schema ): array {
return array(
'type' => 'object',
'properties' => array(
$collection_key => array(
'type' => 'array',
'description' => sprintf(
/* translators: %s: Collection key, such as products or orders. */
__( 'Returned %s for the current page.', 'woocommerce' ),
$collection_key
),
'items' => $item_schema,
),
'total_pages' => array(
'type' => 'integer',
'description' => __( 'Total number of result pages available for the current query.', 'woocommerce' ),
),
'page' => array(
'type' => 'integer',
'description' => __( 'Current result page.', 'woocommerce' ),
),
'per_page' => array(
'type' => 'integer',
'description' => __( 'Maximum number of items requested per page.', 'woocommerce' ),
),
),
'additionalProperties' => false,
);
}