Skip to content

Commit

Permalink
Update class-wp-rest-taxonomies-controller.php
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyBiryukov committed Nov 16, 2023
1 parent 2c89684 commit 95257b3
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function __construct() {
*
* @see register_rest_route()
*/
#[\Override]
public function register_routes() {

register_rest_route(
Expand Down Expand Up @@ -80,6 +81,7 @@ public function register_routes() {
* @param WP_REST_Request $request Full details about the request.
* @return true|WP_Error True if the request has read access, WP_Error object otherwise.
*/
#[\Override]
public function get_items_permissions_check( $request ) {
if ( 'edit' === $request['context'] ) {
if ( ! empty( $request['type'] ) ) {
Expand Down Expand Up @@ -112,6 +114,7 @@ public function get_items_permissions_check( $request ) {
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Response Response object on success, or WP_Error object on failure.
*/
#[\Override]
public function get_items( $request ) {

// Retrieve the list of registered collection query parameters.
Expand Down Expand Up @@ -151,6 +154,7 @@ public function get_items( $request ) {
* @param WP_REST_Request $request Full details about the request.
* @return true|WP_Error True if the request has read access for the item, otherwise false or WP_Error object.
*/
#[\Override]
public function get_item_permissions_check( $request ) {

$tax_obj = get_taxonomy( $request['taxonomy'] );
Expand Down Expand Up @@ -180,6 +184,7 @@ public function get_item_permissions_check( $request ) {
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/
#[\Override]
public function get_item( $request ) {
$tax_obj = get_taxonomy( $request['taxonomy'] );

Expand All @@ -206,6 +211,7 @@ public function get_item( $request ) {
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Response Response object.
*/
#[\Override]
public function prepare_item_for_response( $item, $request ) {
// Restores the more descriptive, specific name for use within this method.
$taxonomy = $item;
Expand Down Expand Up @@ -318,6 +324,7 @@ protected function prepare_links( $taxonomy ) {
*
* @return array Item schema data.
*/
#[\Override]
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
Expand Down Expand Up @@ -439,6 +446,7 @@ public function get_item_schema() {
*
* @return array Collection parameters.
*/
#[\Override]
public function get_collection_params() {
$new_params = array();
$new_params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
Expand Down

0 comments on commit 95257b3

Please sign in to comment.