Adds wp_query_params to missing endpoints. Replaces author_id by just author on mapping.
This commit is contained in:
parent
88ca241401
commit
c18a0c817e
|
@ -66,7 +66,7 @@ class REST_Controller extends \WP_REST_Controller {
|
||||||
'name' => 'title',
|
'name' => 'title',
|
||||||
'title' => 'title',
|
'title' => 'title',
|
||||||
'id' => 'p',
|
'id' => 'p',
|
||||||
'authorid' => 'author_id',
|
'authorid' => 'author',
|
||||||
'authorname' => 'author_name',
|
'authorname' => 'author_name',
|
||||||
'search' => 's',
|
'search' => 's',
|
||||||
'searchterm' => 'search',
|
'searchterm' => 'search',
|
||||||
|
|
|
@ -43,7 +43,7 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params(),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
|
@ -58,7 +58,7 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
'args' => $this->get_wp_query_params(),
|
||||||
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -474,6 +474,10 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
'default' => 'view',
|
'default' => 'view',
|
||||||
'items' => array( 'view, edit' )
|
'items' => array( 'view, edit' )
|
||||||
);
|
);
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params()
|
||||||
|
);
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||||
$map = $this->filter_repository->get_map();
|
$map = $this->filter_repository->get_map();
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params(),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -268,7 +268,17 @@ class REST_Item_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::EDITABLE) {
|
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()
|
||||||
|
);
|
||||||
|
} elseif ($method === \WP_REST_Server::EDITABLE) {
|
||||||
$endpoint_args['values'] = [
|
$endpoint_args['values'] = [
|
||||||
'type' => 'array/string/object/integer',
|
'type' => 'array/string/object/integer',
|
||||||
'items' => [
|
'items' => [
|
||||||
|
|
|
@ -356,6 +356,10 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
'default' => 'view',
|
'default' => 'view',
|
||||||
'items' => array( 'view' )
|
'items' => array( 'view' )
|
||||||
);
|
);
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
|
|
|
@ -569,6 +569,10 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
'default' => 'view',
|
'default' => 'view',
|
||||||
'items' => array( 'view, edit' )
|
'items' => array( 'view, edit' )
|
||||||
);
|
);
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params()
|
||||||
|
);
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||||
$map = $this->metadatum_repository->get_map();
|
$map = $this->metadatum_repository->get_map();
|
||||||
|
|
||||||
|
|
|
@ -452,16 +452,16 @@ 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['fetch_only'] = array(
|
|
||||||
'type' => 'string/array',
|
|
||||||
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
$endpoint_args['context'] = array(
|
$endpoint_args['context'] = array(
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'default' => 'view',
|
'default' => 'view',
|
||||||
'items' => array( 'view, edit' )
|
'items' => array( 'view, edit' )
|
||||||
);
|
);
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params(),
|
||||||
|
parent::get_fetch_only_param()
|
||||||
|
);
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||||
$map = $this->taxonomy_repository->get_map();
|
$map = $this->taxonomy_repository->get_map();
|
||||||
|
|
||||||
|
|
|
@ -425,6 +425,10 @@ class REST_Terms_Controller extends REST_Controller {
|
||||||
'default' => 'view',
|
'default' => 'view',
|
||||||
'items' => array( 'view, edit' )
|
'items' => array( 'view, edit' )
|
||||||
);
|
);
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params()
|
||||||
|
);
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||||
$map = $this->terms_repository->get_map();
|
$map = $this->terms_repository->get_map();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue