Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#56019 closed defect (bug) (fixed)

Add prepare_links method to WP_REST_Post_Types_Controller

Reported by: spacedmonkey Owned by: spacedmonkey
Priority: normal Milestone: 6.1
Component: REST API Version: 4.7
Severity: normal Keywords: good-first-bug has-patch commit add-to-field-guide
Cc: Focuses: rest-api

Description (last modified by spacedmonkey)

Move link logic to prepare_links method in WP_REST_Post_Types_Controller to bring this controller inline with other controllers.

Change History (14)

#1 @spacedmonkey
4 years ago

  • Description modified (diff)

This ticket was mentioned in ​PR #2883 on ​WordPress/wordpress-develop by ​dlh01.


4 years ago
#2

  • Keywords has-patch added; needs-patch removed

​spacedmonkey commented on ​PR #2883:


4 years ago
#3

@dlh01 Let's keep these as they own tickets.
Can you add some unit tests as well please.

​dlh01 commented on ​PR #2883:


4 years ago
#4

@spacedmonkey Are you saying you want separate PRs for each ticket?

​spacedmonkey commented on ​PR #2883:


4 years ago
#5

@spacedmonkey Are you saying you want separate PRs for each ticket?

Yes please.

This ticket was mentioned in ​PR #2965 on ​WordPress/wordpress-develop by ​dlh01.


4 years ago
#6

​dlh01 commented on ​PR #2883:


4 years ago
#7

@spacedmonkey I've opened #2965 and #2966 for the separate tickets and will close this PR.

I see that post type and taxonomy links are currently being tested in ​`WP_Test_REST_Post_Types_Controller::check_post_type_obj()` and ​`WP_Test_REST_Taxonomies_Controller::check_taxonomy_object()`, respectively. Could you elaborate on what kind of test coverage you'd like added?

#8 @spacedmonkey
4 years ago

  • Milestone Future Release → 6.1
  • Owner set to spacedmonkey
  • Status new → assigned

#9 @spacedmonkey
4 years ago

  • Keywords commit added

#10 @spacedmonkey
4 years ago

  • Resolution → fixed
  • Status assigned → closed

In 53721:

REST API: Add prepare_links method to WP_REST_Post_Types_Controller class.

Move logic to from prepare_item_for_response to prepare_links method to bring WP_REST_Post_Types_Controller class inline with other REST API controllers.

Props Spacedmonkey, timothyblynjacobs, dlh.
Fixes #56019.

​spacedmonkey commented on ​PR #2965:


4 years ago
#11

Committed

This ticket was mentioned in ​Slack in #core-restapi by spacedmonkey. ​View the logs.


4 years ago

#13 @milana_cap
4 years ago

  • Keywords add-to-field-guide added

#14 @spacedmonkey
4 years ago

Early draft of a dev note can be found ​here.

Note: See TracTickets for help on using tickets.