Fixes permanently descriptions on DELETE methods. #290
This commit is contained in:
parent
504bb4cd20
commit
355bcda07c
|
@ -293,9 +293,10 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
);
|
||||
|
||||
$query_params['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'enum' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'description' => 'The context in which the request is made.',
|
||||
'enum' => array(
|
||||
'view',
|
||||
'edit'
|
||||
),
|
||||
|
@ -339,7 +340,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
'description' => __( 'Order sort attribute ascending or descending.', 'tainacan' ),
|
||||
'type' => 'string/array',
|
||||
'default' => 'desc',
|
||||
'enum' => array( 'asc', 'desc' ),
|
||||
'enum' => array( 'asc', 'desc', 'ASC', 'DESC' ),
|
||||
);
|
||||
|
||||
$query_params['orderby'] = array(
|
||||
|
|
|
@ -73,8 +73,8 @@ class REST_Collections_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => array(
|
||||
'permanently' => array(
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as true. By default this will only trash collection'),
|
||||
'default' => 'false'
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
||||
'default' => '0',
|
||||
),
|
||||
)
|
||||
),
|
||||
|
|
|
@ -83,8 +83,8 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => array(
|
||||
'permanently' => array(
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as true. By default this will only trash collection'),
|
||||
'default' => 'false'
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
||||
'default' => '0'
|
||||
),
|
||||
)
|
||||
),
|
||||
|
@ -497,16 +497,17 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
* @return array|void
|
||||
*/
|
||||
public function get_wp_query_params() {
|
||||
$query_params['context']['default'] = 'view';
|
||||
|
||||
$query_params = array_merge($query_params, parent::get_wp_query_params());
|
||||
|
||||
$query_params['name'] = array(
|
||||
'description' => __('Limits the result set to filters with a specific name'),
|
||||
'type' => 'string',
|
||||
);
|
||||
|
||||
$query_params = array_merge($query_params, parent::get_meta_queries_params());
|
||||
$query_params = array_merge(
|
||||
$query_params,
|
||||
parent::get_wp_query_params(),
|
||||
parent::get_meta_queries_params()
|
||||
);
|
||||
|
||||
return $query_params;
|
||||
}
|
||||
|
|
|
@ -80,8 +80,8 @@ class REST_Items_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => array(
|
||||
'permanently' => array(
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as true. By default this will only trash collection', 'tainacan'),
|
||||
'default' => 'false'
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection', 'tainacan'),
|
||||
'default' => '0'
|
||||
),
|
||||
)
|
||||
),
|
||||
|
@ -757,9 +757,18 @@ class REST_Items_Controller extends REST_Controller {
|
|||
$endpoint_args = [];
|
||||
|
||||
if($method === \WP_REST_Server::READABLE) {
|
||||
$endpoint_args['fetch_only'] = array(
|
||||
'type' => 'string/array',
|
||||
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.' ),
|
||||
$endpoint_args['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'description' => 'The context in which the request is made.',
|
||||
'enum' => array(
|
||||
'view',
|
||||
'edit'
|
||||
),
|
||||
);
|
||||
$endpoint_args = array_merge(
|
||||
$endpoint_args,
|
||||
parent::get_fetch_only_param()
|
||||
);
|
||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||
$map = $this->items_repository->get_map();
|
||||
|
@ -785,16 +794,16 @@ class REST_Items_Controller extends REST_Controller {
|
|||
* @return array|void
|
||||
*/
|
||||
public function get_wp_query_params() {
|
||||
$query_params['context']['default'] = 'view';
|
||||
|
||||
array_merge($query_params, parent::get_wp_query_params());
|
||||
|
||||
$query_params['title'] = array(
|
||||
'description' => __('Limits the result set to items with a specific title'),
|
||||
'type' => 'string',
|
||||
);
|
||||
|
||||
$query_params = array_merge($query_params, parent::get_meta_queries_params());
|
||||
$query_params = array_merge(
|
||||
$query_params,
|
||||
parent::get_wp_query_params(),
|
||||
parent::get_meta_queries_params()
|
||||
);
|
||||
|
||||
return $query_params;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ class REST_Metadata_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
||||
),
|
||||
// ENDPOINT X. THIS ENDPOINT DO THE SAME THING OF ENDPOINT Z. I hope in a brief future it function changes.
|
||||
array(
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array($this, 'delete_item'),
|
||||
|
|
|
@ -62,8 +62,8 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => array(
|
||||
'permanently' => array(
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as true. By default this will only trash collection'),
|
||||
'default' => 'false',
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
||||
'default' => '0',
|
||||
),
|
||||
)
|
||||
),
|
||||
|
|
|
@ -56,8 +56,9 @@ class REST_Terms_Controller extends REST_Controller {
|
|||
'callback' => array($this, 'delete_item'),
|
||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => [
|
||||
'info' => [
|
||||
'description' => __('Delete term permanently.')
|
||||
'permanently' => [
|
||||
'description' => __('Delete term permanently.'),
|
||||
'default' => '1'
|
||||
]
|
||||
]
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue