LLMS_REST_Posts_Controller::get_collection_params()

Retrieves the query params for the objects collection


Return Return

(array) Collection parameters.


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-posts-controller.php

	public function get_collection_params() {

		$query_params = parent::get_collection_params();
		$schema       = $this->get_item_schema();

		if ( isset( $schema['properties']['status'] ) ) {
			$query_params['status'] = array(
				'default'           => 'publish',
				'description'       => __( 'Limit result set to posts assigned one or more statuses.', 'lifterlms' ),
				'type'              => 'array',
				'items'             => array(
					'enum' => array_merge(
						array_keys(
							get_post_stati()
						),
						array(
							'any',
						)
					),
					'type' => 'string',
				),
				'sanitize_callback' => array( $this, 'sanitize_post_statuses' ),
			);
		}

		return $query_params;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.19 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.