Make WordPress Core

Changes between Initial Version and Version 14 of Ticket #60131


Ignore:
Timestamp:
02/05/2024 09:45:45 PM (4 months ago)
Author:
ramonopoly
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #60131

    • Property Status changed from new to assigned
    • Property Summary changed from Global styles revisions controller: extend with WP_REST_Revisions_Controller to Global styles controllers: extend classes with WP_REST_Posts_Controller and WP_REST_Revisions_Controller
    • Property Owner set to spacedmonkey
    • Property Milestone changed from Awaiting Review to 6.5
    • Property Keywords has-patch has-unit-tests commit added
  • Ticket #60131 – Description

    initial v14  
    1 The global styles revisions controller was introduced in [https://github.com/WordPress/gutenberg/pull/49974 WordPress/gutenberg#49974].
     1As part of the efforts to improve the maintainability of Global Styles REST controllers, and to remove a lot of duplicate code we can:
    22
    3 Originally, global styles revisions were a bit new and had the following characteristics:
     3- extend `WP_REST_Global_Styles_Controller` with `WP_REST_Posts_Controller`.
     4- extend `WP_REST_Global_Styles_Revisions_Controller` with `WP_REST_Revisions_Controller`.
     5
     6
     7
     8Originally, global styles were a bit new and had the following characteristics:
    49
    510- Didn't, and still doesn't, return excerpt, content, guid fields
    611- Had to do some JSON parsing when preparing the response
    712
     13In other words, the functionality was "special" enough not to warrant extending the base controller instead of using WP_REST_Posts_Controller. Also, global styles were new and evolving.
    814
    9 Back then, it was more code to override the parent class's functions, and I thought having it as a stand alone class left more elbow room for subsequent tweaks and changes. Especially since global styles revisions were new and evolving.
    1015
    11 Now that global styles revisions have "settled", and shares more methods with WP_REST_Revisions_Controller, it makes sense to change the base class for more consistent interface, less code and less maintenance burden.
     16For revisions especially, more code was required to override the parent class's functions, and having a stand alone class left more elbow room for subsequent tweaks and changes.
    1217
    13 See discussion: [https://github.com/WordPress/gutenberg/pull/55827#discussion_r1399856581 WordPress/gutenberg#55827 (comment)]
     18Now that global styles have "settled" however, and shares more methods with `WP_REST_Posts_Controller` amd `WP_REST_Revisions_Controller`, it makes sense to change the base classes for more consistent interface, less code and less maintenance burden.
    1419
     20See discussion and related PRs:
     21
     22- [https://github.com/WordPress/gutenberg/pull/55827#discussion_r1399856581 WordPress/gutenberg#55827 (comment)]
     23- [https://github.com/WordPress/gutenberg/pull/49974 Rest API: add /revisions endpoint for global styles]
     24- [https://github.com/WordPress/gutenberg/pull/35801 Add a Global Styles endpoint and use it in the site editor]
     25
     26
     27
     28
     29
     30