WordPress/wp-includes/rest-api/endpoints
spacedmonkey 6e774df98c REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers.
The Template and Template Part REST API controllers have unique characteristics compared to other post type REST API controllers. They do not rely on integer IDs to reference objects; instead, they use a combination of the theme name and slug of the template, like 'twentytwentyfour//home.' Consequently, when the post types template and template part were introduced in [52062], it led to the registration of REST API endpoints for autosaves and revisions with invalid URL structures.

In this commit, we introduce new functionality to enable custom autosave and revisions endpoints to be registered at the post type level. Similar to the 'rest_controller_class' parameter, developers can now define 'revisions_rest_controller' and 'autosave_rest_controller.' This empowers developers to create custom controllers for these functionalities. Additionally, we introduce a 'late_route_registration' parameter, which proves helpful when dealing with custom URL patterns and regex pattern matching issues.
This commit registers new classes for template and template part autosave and revisions controllers, differentiating them from standard controllers in the following ways:
* The response shape now matches that of the template controller.
* Permission checks align with the template controller.
* A custom URL pattern is introduced to support slug-based identification of templates.

Furthermore, we've updated the utility function '_build_block_template_result_from_post' to support passing revision post objects. This enhancement ensures compatibility with the custom revisions controller.

Props spacedmonkey, revgeorge, andraganescu, hellofromTonya, antonvlasenko, kadamwhite, ironprogrammer, costdev, mukesh27, timothyblynjacobs, adamsilverstein. 
Fixes 56922.
Built from https://develop.svn.wordpress.org/trunk@56819


git-svn-id: http://core.svn.wordpress.org/trunk@56331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 14:05:21 +00:00
..
class-wp-rest-application-passwords-controller.php
class-wp-rest-attachments-controller.php
class-wp-rest-autosaves-controller.php REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers. 2023-10-10 14:05:21 +00:00
class-wp-rest-block-directory-controller.php
class-wp-rest-block-pattern-categories-controller.php
class-wp-rest-block-patterns-controller.php
class-wp-rest-block-renderer-controller.php
class-wp-rest-block-types-controller.php
class-wp-rest-blocks-controller.php
class-wp-rest-comments-controller.php Comments: Improve WP_Comment_Query count query performance by setting 'order by' to 'none'. 2023-09-29 17:13:24 +00:00
class-wp-rest-controller.php
class-wp-rest-edit-site-export-controller.php
class-wp-rest-global-styles-controller.php Coding Standards: Remove redundant ignore annotations, take 5. 2023-10-02 11:27:24 +00:00
class-wp-rest-global-styles-revisions-controller.php
class-wp-rest-menu-items-controller.php
class-wp-rest-menu-locations-controller.php
class-wp-rest-menus-controller.php
class-wp-rest-navigation-fallback-controller.php
class-wp-rest-pattern-directory-controller.php Coding Standards: Remove redundant ignore annotations, take 5. 2023-10-02 11:27:24 +00:00
class-wp-rest-plugins-controller.php
class-wp-rest-post-statuses-controller.php
class-wp-rest-post-types-controller.php
class-wp-rest-posts-controller.php
class-wp-rest-revisions-controller.php Revisions: framework for storing post meta revisions. 2023-09-26 15:32:19 +00:00
class-wp-rest-search-controller.php
class-wp-rest-settings-controller.php
class-wp-rest-sidebars-controller.php
class-wp-rest-site-health-controller.php
class-wp-rest-taxonomies-controller.php
class-wp-rest-template-autosaves-controller.php REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers. 2023-10-10 14:05:21 +00:00
class-wp-rest-template-revisions-controller.php REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers. 2023-10-10 14:05:21 +00:00
class-wp-rest-templates-controller.php REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers. 2023-10-10 14:05:21 +00:00
class-wp-rest-terms-controller.php
class-wp-rest-themes-controller.php
class-wp-rest-url-details-controller.php
class-wp-rest-users-controller.php
class-wp-rest-widget-types-controller.php
class-wp-rest-widgets-controller.php