public function prepare_item_for_response( $status, $request ) {

		$data = array(
			'name'         => $status->label,
			'private'      => (bool) $status->private,
			'protected'    => (bool) $status->protected,
			'public'       => (bool) $status->public,
			'queryable'    => (bool) $status->publicly_queryable,
			'show_in_list' => (bool) $status->show_in_admin_all_list,
			'slug'         => $status->name,
		);

		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
		$data = $this->add_additional_fields_to_object( $data, $request );
		$data = $this->filter_response_by_context( $data, $context );

		$response = rest_ensure_response( $data );

		if ( 'publish' === $status->name ) {
			$response->add_link( 'archives', rest_url( 'wp/v2/posts' ) );
		} else {
			$response->add_link( 'archives', add_query_arg( 'status', $status->name, rest_url( 'wp/v2/posts' ) ) );
		}

		/**
		 * Filter a status returned from the API.
		 *
		 * Allows modification of the status data right before it is returned.
		 *
		 * @param WP_REST_Response  $response The response object.
		 * @param object            $status   The original status object.
		 * @param WP_REST_Request   $request  Request used to generate the response.
		 */
		return apply_filters( 'rest_prepare_status', $response, $status, $request );
	}
public function prepare_item_for_response( $status, $request ) {

		$data = array(
			'name'         => $status->label,
			'private'      => (bool) $status->private,
			'protected'    => (bool) $status->protected,
			'public'       => (bool) $status->public,
			'queryable'    => (bool) $status->publicly_queryable,
			'show_in_list' => (bool) $status->show_in_admin_all_list,
			'slug'         => $status->name,
		);

		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
		$data = $this->add_additional_fields_to_object( $data, $request );
		$data = $this->filter_response_by_context( $data, $context );

		$response = rest_ensure_response( $data );

		if ( 'publish' === $status->name ) {
			$response->add_link( 'archives', rest_url( 'wp/v2/posts' ) );
		} else {
			$response->add_link( 'archives', add_query_arg( 'status', $status->name, rest_url( 'wp/v2/posts' ) ) );
		}

		/**
		 * Filter a status returned from the API.
		 *
		 * Allows modification of the status data right before it is returned.
		 *
		 * @param WP_REST_Response  $response The response object.
		 * @param object            $status   The original status object.
		 * @param WP_REST_Request   $request  Request used to generate the response.
		 */
		return apply_filters( 'rest_prepare_status', $response, $status, $request );
	}
public function prepare_item_for_response ( $ status , $ request ) { $ data = array ( 'name' => $ status -> label , 'private' => ( bool ) $ status -> private , 'protected' => ( bool ) $ status -> protected , 'public' => ( bool ) $ status -> public , 'queryable' => ( bool ) $ status -> publicly_queryable , 'show_in_list' => ( bool ) $ status -> show_in_admin_all_list , 'slug' => $ status -> name , ) ; $ context = ! empty ( $ request [ 'context' ] ) ? $ request [ 'context' ] : 'view' ; $ data = $ this -> add_additional_fields_to_object ( $ data , $ request ) ; $ data = $ this -> filter_response_by_context ( $ data , $ context ) ; $ response = rest_ensure_response ( $ data ) ; if ( 'publish' === $ status -> name ) { $ response -> add_link ( 'archives' , rest_url ( 'wp/v2/posts' ) ) ; } else { $ response -> add_link ( 'archives' , add_query_arg ( 'status' , $ status -> name , rest_url ( 'wp/v2/posts' ) ) ) ; } /**
		 * Filter a status returned from the API.
		 *
		 * Allows modification of the status data right before it is returned.
		 *
		 * @param WP_REST_Response  $response The response object.
		 * @param object            $status   The original status object.
		 * @param WP_REST_Request   $request  Request used to generate the response.
		 */ return apply_filters ( 'rest_prepare_status' , $ response , $ status , $ request ) ; }
Prepare a post status object for serialization

@param stdClass $status Post status data
@param WP_REST_Request $request
@return WP_REST_Response Post status data
Prepare a post status object for serialization