Make WordPress Core


Ignore:
Timestamp:
05/28/2024 12:38:28 PM (14 months ago)
Author:
swissspidy
Message:

REST API: Refactor global styles endpoints in REST API to register with post type.

Updated the global styles endpoints in the REST API to extend from existing posts and revisions controllers. This reduces duplicated code and inconsistencies. The revisions controller is now a subclass of the WP_REST_Revisions_Controller. Related redundant methods were removed and schema generation and collection parameters were adjusted to suit the global styles context. Updated permission checks, constructor, and collection parameters accordingly. This change allows for easy override of these classes using the register_post_type_args filter.

This reintroduces [57624] (reverted in [57628]) with improved backward compatibility and further enhancements.

Props ramonopoly, spacedmonkey, mukesh27, swissspidy.
Fixes #60131.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-settings.php

    r58188 r58225  
    285285require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-attachments-controller.php';
    286286require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-global-styles-controller.php';
    287 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php';
    288287require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-types-controller.php';
    289288require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-statuses-controller.php';
    290289require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-revisions-controller.php';
     290require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php';
    291291require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-template-revisions-controller.php';
    292292require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-autosaves-controller.php';
Note: See TracChangeset for help on using the changeset viewer.