Adds context to wp_meta_queries

This commit is contained in:
Mateus Machado Luna 2019-10-21 12:25:28 -03:00
parent c18a0c817e
commit 4277fc951a
9 changed files with 7 additions and 42 deletions

View File

@ -286,11 +286,18 @@ class REST_Controller extends \WP_REST_Controller {
* @return array|void
*/
public function get_wp_query_params(){
$query_params['id'] = array(
'description' => __("Limit result to objects with specific id.", 'tainacan'),
'type' => 'integer',
);
$query_params['context'] = array(
'type' => 'string',
'default' => 'view',
'items' => array( 'view, edit' )
);
$query_params['search'] = array(
'description' => __( 'Limit results to those matching a string.', 'tainacan' ),
'type' => 'string',

View File

@ -478,12 +478,6 @@ class REST_Collections_Controller extends REST_Controller {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'items' => array( 'view, edit' )
);
$endpoint_args['name'] = array(
'description' => __('Limits the result set to collections with a specific name'),
'type' => 'string',

View File

@ -469,11 +469,6 @@ class REST_Filters_Controller extends REST_Controller {
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'items' => array( 'view, edit' )
);
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()

View File

@ -269,11 +269,6 @@ class REST_Item_Metadata_Controller extends REST_Controller {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'items' => array( 'view, edit' )
);
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()

View File

@ -761,12 +761,6 @@ class REST_Items_Controller extends REST_Controller {
'type' => 'string/array',
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.' ),
);
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'items' => array( 'view, edit' )
);
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
$map = $this->items_repository->get_map();

View File

@ -351,11 +351,6 @@ class REST_Logs_Controller extends REST_Controller {
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'items' => array( 'view' )
);
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()

View File

@ -564,11 +564,6 @@ class REST_Metadata_Controller extends REST_Controller {
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'items' => array( 'view, edit' )
);
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()

View File

@ -452,11 +452,6 @@ class REST_Taxonomies_Controller extends REST_Controller {
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'items' => array( 'view, edit' )
);
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params(),

View File

@ -420,11 +420,6 @@ class REST_Terms_Controller extends REST_Controller {
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'items' => array( 'view, edit' )
);
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()