• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WooCommerce a2z

WooCommerce a2z

WooCommerce

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / AbstractTermsRoute::get_collection_params() – Get the query params for collections of attributes.

You appear to be a bot. Output may be restricted

Description

Get the query params for collections of attributes.

Usage

$array = AbstractTermsRoute::get_collection_params();

Parameters

Returns

array

Source

File name: woocommerce/packages/woocommerce-blocks/src/StoreApi/Routes/AbstractTermsRoute.php
Lines:

1 to 78 of 78
  public function get_collection_params() {
    $params                       = array();
    $params['context']            = $this->get_context_param();
    $params['context']['default'] = 'view';

    $params['page'] = array(
      'description'       => __( 'Current page of the collection.', 'woocommerce' ),
      'type'              => 'integer',
      'default'           => 1,
      'sanitize_callback' => 'absint',
      'validate_callback' => 'rest_validate_request_arg',
      'minimum'           => 1,
    );

    $params['per_page'] = array(
      'description'       => __( 'Maximum number of items to be returned in result set. Defaults to no limit if left blank.', 'woocommerce' ),
      'type'              => 'integer',
      'minimum'           => 0,
      'maximum'           => 100,
      'sanitize_callback' => 'absint',
      'validate_callback' => 'rest_validate_request_arg',
    );

    $params['search'] = array(
      'description'       => __( 'Limit results to those matching a string.', 'woocommerce' ),
      'type'              => 'string',
      'sanitize_callback' => 'sanitize_text_field',
      'validate_callback' => 'rest_validate_request_arg',
    );

    $params['exclude'] = array(
      'description'       => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
      'type'              => 'array',
      'items'             => array(
        'type' => 'integer',
      ),
      'default'           => array(),
      'sanitize_callback' => 'wp_parse_id_list',
    );

    $params['include'] = array(
      'description'       => __( 'Limit result set to specific ids.', 'woocommerce' ),
      'type'              => 'array',
      'items'             => array(
        'type' => 'integer',
      ),
      'default'           => array(),
      'sanitize_callback' => 'wp_parse_id_list',
    );

    $params['order'] = array(
      'description'       => __( 'Sort ascending or descending.', 'woocommerce' ),
      'type'              => 'string',
      'default'           => 'asc',
      'enum'              => array( 'asc', 'desc' ),
      'validate_callback' => 'rest_validate_request_arg',
    );

    $params['orderby'] = array(
      'description'       => __( 'Sort by term property.', 'woocommerce' ),
      'type'              => 'string',
      'default'           => 'name',
      'enum'              => array(
        'name',
        'slug',
        'count',
      ),
      'validate_callback' => 'rest_validate_request_arg',
    );

    $params['hide_empty'] = array(
      'description' => __( 'If true, empty terms will not be returned.', 'woocommerce' ),
      'type'        => 'boolean',
      'default'     => true,
    );

    return $params;
  }
 

 View on GitHub View on Trac

Published: 21st August 2020 | Last updated: 10th December 2020

Primary Sidebar

Information

Function name: AbstractTermsRoute::get_collection_params
Class ref: AbstractTermsRoute
Plugin ref: WooCommerce
Version: 5.1.0
Sourcefile: packages/woocommerce-blocks/src/StoreApi/Routes/AbstractTermsRoute.php
File ref: packages/woocommerce-blocks/src/StoreApi/Routes/AbstractTermsRoute.php
Deprecated?: No
API Letters: A,C,G,P

Footer

WooCommerce a2z
WooCommerce a2z
WooCommerce
WordPress 5.7.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  woocommerce.wp-a2z.org
© Copyright WooCommerce a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites