| @@ -136,9 +136,9 @@ | ||
| 136 | 136 | */ |
| 137 | 137 | public function get_items_permissions_check( $request ) { |
| 138 | 138 | |
| 139 | 139 | if ( 'edit' === $request['context'] && ! current_user_can( $this->table->cap->edit_items ) ) { |
| 140 | - return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit items of this type.' ), array( 'status' => rest_authorization_required_code() ) ); | |
| 140 | + return new WP_Error( 'rest_forbidden_context', ct_get_table_label( $this->table->name, 'edit_items_not_allowed' ), array( 'status' => rest_authorization_required_code() ) ); | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | return true; |
| 144 | 144 | } |
| @@ -374,13 +374,13 @@ | ||
| 374 | 374 | * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise. |
| 375 | 375 | */ |
| 376 | 376 | public function create_item_permissions_check( $request ) { |
| 377 | 377 | if ( ! empty( $request['id'] ) ) { |
| 378 | - return new WP_Error( 'rest_item_exists', __( 'Cannot create existing item.' ), array( 'status' => 400 ) ); | |
| 378 | + return new WP_Error( 'rest_item_exists', __( 'Cannot create existing item.', 'ct' ), array( 'status' => 400 ) ); | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | if ( ! current_user_can( $this->table->cap->create_items ) ) { |
| 382 | - return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create items as this user.' ), array( 'status' => rest_authorization_required_code() ) ); | |
| 382 | + return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create items as this user.', 'ct' ), array( 'status' => rest_authorization_required_code() ) ); | |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | return true; |
| 386 | 386 | } |
| @@ -394,9 +394,9 @@ | ||
| 394 | 394 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| 395 | 395 | */ |
| 396 | 396 | public function create_item( $request ) { |
| 397 | 397 | if ( ! empty( $request['id'] ) ) { |
| 398 | - return new WP_Error( 'rest_item_exists', __( 'Cannot create existing item.' ), array( 'status' => 400 ) ); | |
| 398 | + return new WP_Error( 'rest_item_exists', __( 'Cannot create existing item.', 'ct' ), array( 'status' => 400 ) ); | |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | ct_setup_table( $this->name ); |
| 402 | 402 | |
| @@ -677,9 +677,9 @@ | ||
| 677 | 677 | $response = $this->prepare_item_for_response( $object, $request ); |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | if ( ! $result ) { |
| 681 | - return new WP_Error( 'rest_cannot_delete', __( 'The item cannot be deleted.' ), array( 'status' => 500 ) ); | |
| 681 | + return new WP_Error( 'rest_cannot_delete', __( 'The item cannot be deleted.', 'ct' ), array( 'status' => 500 ) ); | |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | /** |
| 685 | 685 | * Fires immediately after a single post is deleted or trashed via the REST API. |