wp/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
   220 	 * @return WP_REST_Response Post status data.
   220 	 * @return WP_REST_Response Post status data.
   221 	 */
   221 	 */
   222 	public function prepare_item_for_response( $item, $request ) {
   222 	public function prepare_item_for_response( $item, $request ) {
   223 		// Restores the more descriptive, specific name for use within this method.
   223 		// Restores the more descriptive, specific name for use within this method.
   224 		$status = $item;
   224 		$status = $item;
       
   225 
   225 		$fields = $this->get_fields_for_response( $request );
   226 		$fields = $this->get_fields_for_response( $request );
   226 		$data   = array();
   227 		$data   = array();
   227 
   228 
   228 		if ( in_array( 'name', $fields, true ) ) {
   229 		if ( in_array( 'name', $fields, true ) ) {
   229 			$data['name'] = $status->label;
   230 			$data['name'] = $status->label;
   367 	public function get_collection_params() {
   368 	public function get_collection_params() {
   368 		return array(
   369 		return array(
   369 			'context' => $this->get_context_param( array( 'default' => 'view' ) ),
   370 			'context' => $this->get_context_param( array( 'default' => 'view' ) ),
   370 		);
   371 		);
   371 	}
   372 	}
   372 
       
   373 }
   373 }