- Timestamp:
- 11/30/2017 11:09:33 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
r42000 r42343 306 306 public function get_collection_params() { 307 307 return array( 308 'context' 309 'page' 310 'description' 311 'type' 312 'default' 313 'sanitize_callback' 314 'validate_callback' 315 'minimum' 308 'context' => $this->get_context_param(), 309 'page' => array( 310 'description' => __( 'Current page of the collection.' ), 311 'type' => 'integer', 312 'default' => 1, 313 'sanitize_callback' => 'absint', 314 'validate_callback' => 'rest_validate_request_arg', 315 'minimum' => 1, 316 316 ), 317 'per_page' 318 'description' 319 'type' 320 'default' 321 'minimum' 322 'maximum' 323 'sanitize_callback' 324 'validate_callback' 317 'per_page' => array( 318 'description' => __( 'Maximum number of items to be returned in result set.' ), 319 'type' => 'integer', 320 'default' => 10, 321 'minimum' => 1, 322 'maximum' => 100, 323 'sanitize_callback' => 'absint', 324 'validate_callback' => 'rest_validate_request_arg', 325 325 ), 326 'search' 327 'description' 328 'type' 329 'sanitize_callback' 330 'validate_callback' 326 'search' => array( 327 'description' => __( 'Limit results to those matching a string.' ), 328 'type' => 'string', 329 'sanitize_callback' => 'sanitize_text_field', 330 'validate_callback' => 'rest_validate_request_arg', 331 331 ), 332 332 ); … … 345 345 public function get_context_param( $args = array() ) { 346 346 $param_details = array( 347 'description' 348 'type' 349 'sanitize_callback' 350 'validate_callback' 347 'description' => __( 'Scope under which the request is made; determines fields present in response.' ), 348 'type' => 'string', 349 'sanitize_callback' => 'sanitize_key', 350 'validate_callback' => 'rest_validate_request_arg', 351 351 ); 352 352 … … 557 557 // Only use required / default from arg_options on CREATABLE endpoints. 558 558 if ( WP_REST_Server::CREATABLE !== $method ) { 559 $params['arg_options'] = array_diff_key( $params['arg_options'], array( 'required' => '', 'default' => '' ) ); 559 $params['arg_options'] = array_diff_key( 560 $params['arg_options'], array( 561 'required' => '', 562 'default' => '', 563 ) 564 ); 560 565 } 561 566
Note: See TracChangeset
for help on using the changeset viewer.