Skip to content

Commit

Permalink
Update class-wp-rest-post-types-controller.php
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyBiryukov committed Nov 16, 2023
1 parent b44125e commit 0c5a12b
Showing 1 changed file with 7 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'] ) {
$types = get_post_types( array( 'show_in_rest' => true ), 'objects' );
Expand Down Expand Up @@ -108,6 +110,7 @@ public function get_items_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_items( $request ) {
$data = array();
$types = get_post_types( array( 'show_in_rest' => true ), 'objects' );
Expand All @@ -132,6 +135,7 @@ public function get_items( $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 ) {
$obj = get_post_type_object( $request['type'] );

Expand Down Expand Up @@ -174,6 +178,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.
$post_type = $item;
Expand Down Expand Up @@ -299,6 +304,7 @@ protected function prepare_links( $post_type ) {
*
* @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 @@ -421,6 +427,7 @@ public function get_item_schema() {
*
* @return array Collection parameters.
*/
#[\Override]
public function get_collection_params() {
return array(
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
Expand Down

0 comments on commit 0c5a12b

Please sign in to comment.