Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php

    r47034 r47122  
    9090            }
    9191
    92             return new WP_Error( 'rest_cannot_view', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
     92            return new WP_Error(
     93                'rest_cannot_view',
     94                __( 'Sorry, you are not allowed to edit posts in this post type.' ),
     95                array( 'status' => rest_authorization_required_code() )
     96            );
    9397        }
    9498
     
    132136
    133137        if ( empty( $obj ) ) {
    134             return new WP_Error( 'rest_type_invalid', __( 'Invalid post type.' ), array( 'status' => 404 ) );
     138            return new WP_Error(
     139                'rest_type_invalid',
     140                __( 'Invalid post type.' ),
     141                array( 'status' => 404 )
     142            );
    135143        }
    136144
    137145        if ( empty( $obj->show_in_rest ) ) {
    138             return new WP_Error( 'rest_cannot_read_type', __( 'Cannot view post type.' ), array( 'status' => rest_authorization_required_code() ) );
     146            return new WP_Error(
     147                'rest_cannot_read_type',
     148                __( 'Cannot view post type.' ),
     149                array( 'status' => rest_authorization_required_code() )
     150            );
    139151        }
    140152
    141153        if ( 'edit' === $request['context'] && ! current_user_can( $obj->cap->edit_posts ) ) {
    142             return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
     154            return new WP_Error(
     155                'rest_forbidden_context',
     156                __( 'Sorry, you are not allowed to edit posts in this post type.' ),
     157                array( 'status' => rest_authorization_required_code() )
     158            );
    143159        }
    144160
     
    322338
    323339        $this->schema = $schema;
     340
    324341        return $this->add_additional_fields_schema( $this->schema );
    325342    }
Note: See TracChangeset for help on using the changeset viewer.