Adds context to wp_meta_queries
This commit is contained in:
parent
c18a0c817e
commit
4277fc951a
|
@ -286,11 +286,18 @@ class REST_Controller extends \WP_REST_Controller {
|
||||||
* @return array|void
|
* @return array|void
|
||||||
*/
|
*/
|
||||||
public function get_wp_query_params(){
|
public function get_wp_query_params(){
|
||||||
|
|
||||||
$query_params['id'] = array(
|
$query_params['id'] = array(
|
||||||
'description' => __("Limit result to objects with specific id.", 'tainacan'),
|
'description' => __("Limit result to objects with specific id.", 'tainacan'),
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$query_params['context'] = array(
|
||||||
|
'type' => 'string',
|
||||||
|
'default' => 'view',
|
||||||
|
'items' => array( 'view, edit' )
|
||||||
|
);
|
||||||
|
|
||||||
$query_params['search'] = array(
|
$query_params['search'] = array(
|
||||||
'description' => __( 'Limit results to those matching a string.', 'tainacan' ),
|
'description' => __( 'Limit results to those matching a string.', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
|
|
@ -478,12 +478,6 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [];
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
if($method === \WP_REST_Server::READABLE) {
|
||||||
|
|
||||||
$endpoint_args['context'] = array(
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'view',
|
|
||||||
'items' => array( 'view, edit' )
|
|
||||||
);
|
|
||||||
|
|
||||||
$endpoint_args['name'] = array(
|
$endpoint_args['name'] = array(
|
||||||
'description' => __('Limits the result set to collections with a specific name'),
|
'description' => __('Limits the result set to collections with a specific name'),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
|
|
@ -469,11 +469,6 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [];
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
if($method === \WP_REST_Server::READABLE) {
|
||||||
$endpoint_args['context'] = array(
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'view',
|
|
||||||
'items' => array( 'view, edit' )
|
|
||||||
);
|
|
||||||
$endpoint_args = array_merge(
|
$endpoint_args = array_merge(
|
||||||
$endpoint_args,
|
$endpoint_args,
|
||||||
parent::get_wp_query_params()
|
parent::get_wp_query_params()
|
||||||
|
|
|
@ -269,11 +269,6 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [];
|
||||||
|
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
if($method === \WP_REST_Server::READABLE) {
|
||||||
$endpoint_args['context'] = array(
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'view',
|
|
||||||
'items' => array( 'view, edit' )
|
|
||||||
);
|
|
||||||
$endpoint_args = array_merge(
|
$endpoint_args = array_merge(
|
||||||
$endpoint_args,
|
$endpoint_args,
|
||||||
parent::get_wp_query_params()
|
parent::get_wp_query_params()
|
||||||
|
|
|
@ -761,12 +761,6 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
'type' => 'string/array',
|
'type' => 'string/array',
|
||||||
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.' ),
|
'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) {
|
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||||
$map = $this->items_repository->get_map();
|
$map = $this->items_repository->get_map();
|
||||||
|
|
||||||
|
|
|
@ -351,11 +351,6 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [];
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
if($method === \WP_REST_Server::READABLE) {
|
||||||
$endpoint_args['context'] = array(
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'view',
|
|
||||||
'items' => array( 'view' )
|
|
||||||
);
|
|
||||||
$endpoint_args = array_merge(
|
$endpoint_args = array_merge(
|
||||||
$endpoint_args,
|
$endpoint_args,
|
||||||
parent::get_wp_query_params()
|
parent::get_wp_query_params()
|
||||||
|
|
|
@ -564,11 +564,6 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [];
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
if($method === \WP_REST_Server::READABLE) {
|
||||||
$endpoint_args['context'] = array(
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'view',
|
|
||||||
'items' => array( 'view, edit' )
|
|
||||||
);
|
|
||||||
$endpoint_args = array_merge(
|
$endpoint_args = array_merge(
|
||||||
$endpoint_args,
|
$endpoint_args,
|
||||||
parent::get_wp_query_params()
|
parent::get_wp_query_params()
|
||||||
|
|
|
@ -452,11 +452,6 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [];
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
if($method === \WP_REST_Server::READABLE) {
|
||||||
$endpoint_args['context'] = array(
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'view',
|
|
||||||
'items' => array( 'view, edit' )
|
|
||||||
);
|
|
||||||
$endpoint_args = array_merge(
|
$endpoint_args = array_merge(
|
||||||
$endpoint_args,
|
$endpoint_args,
|
||||||
parent::get_wp_query_params(),
|
parent::get_wp_query_params(),
|
||||||
|
|
|
@ -420,11 +420,6 @@ class REST_Terms_Controller extends REST_Controller {
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [];
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
if($method === \WP_REST_Server::READABLE) {
|
||||||
$endpoint_args['context'] = array(
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'view',
|
|
||||||
'items' => array( 'view, edit' )
|
|
||||||
);
|
|
||||||
$endpoint_args = array_merge(
|
$endpoint_args = array_merge(
|
||||||
$endpoint_args,
|
$endpoint_args,
|
||||||
parent::get_wp_query_params()
|
parent::get_wp_query_params()
|
||||||
|
|
Loading…
Reference in New Issue