REST_Elements_Controller::get_collection_params()

Retrieves the query params for the models collection.

Description

Return

(array) Collection parameters.

Source

File: src/db-objects/elements/rest-elements-controller.php

	public function get_collection_params() {
		$query_params = parent::get_collection_params();

		$query_params['per_page']['maximum'] = 500;
		$query_params['orderby']['default'] = 'sort';

		$query_params['form_id'] = array(
			'description' => __( 'Limit result set to elements associated with a specific form ID.', 'torro-forms' ),
			'type'        => 'integer',
			'minimum'     => 1,
		);

		$query_params['container_id'] = array(
			'description' => __( 'Limit result set to elements associated with a specific container ID.', 'torro-forms' ),
			'type'        => 'integer',
			'minimum'     => 1,
		);

		$query_params['type'] = array(
			'description'       => __( 'Limit result set to elements with one or more specific statuses.', 'torro-forms' ),
			'type'              => 'array',
			'items'             => array(
				'type' => 'string',
				'enum' => array_keys( $this->manager->types()->get_all() ),
			),
			'sanitize_callback' => array( $this, 'sanitize_type_param' ),
		);

		return $query_params;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.