-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update/global styles revision extends revisions controller #6105
Update/global styles revision extends revisions controller #6105
Conversation
WP_REST_Global_Styles_Revisions_Controller extends WP_REST_Controller
…ted from WP_REST_Revisions_Controller tests
…-revisions-controller.php Co-authored-by: Mukesh Panchal <[email protected]>
Excluding order and order by from the collection query params Comment
… individual items.
Updating generated API file
removing __construct, get_item and update_item in favour of the parent class methods Add $allow_batch property, setting it to false
Co-authored-by: Jonny Harris <[email protected]>
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @jonnynews. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Committed |
@getdave @ramonjd @swissspidy Can you take a look at this PR. This fix 95db1e9 make the e2e test pass. But I would love your thoughts on this PR. |
src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
Outdated
Show resolved
Hide resolved
This commit adds the 'allow_batch' option to several API endpoints in the WordPress API generated tests fixture. The 'allow_batch' option has been set to false for version 1, effectively disabling batch requests for these endpoints, as a safety measure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the quick handling, and for the constant help in getting this change in.
$this->namespace = 'wp/v2'; | ||
$this->rest_base = 'global-styles'; | ||
$this->post_type = 'wp_global_styles'; | ||
public function __construct( $post_type = 'wp_global_styles' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. I've tested with the plugin activated (with and without this change).
It also provides backwards compatibility for folks running older versions of Gutenberg.
If folks think it's appropriate I can update the class instantiation in Gutenberg to pass 'wp_global_styles'
as well, to make things more consistent. But this PR's changes make that unnecessary I suppose.
src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
Outdated
Show resolved
Hide resolved
src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
Outdated
Show resolved
Hide resolved
Bumped version from 6.5 to 6.6 in annotations
Various code documentation version annotations have been updated from 6.5.0 to 6.6.0. This includes adjustments in class-wp-post-type.php and the REST endpoints for global styles and global styles revisions. These changes document accurately in which version these alterations were introduced.
The commit transforms multiple unset function calls into single line statements in the WP Rest Global Styles Revisions Controller. This aims to enhance code readability and maintainability, without changing functionality.
@swissspidy Do you mind doing a review of this PR. I like think this PR is ready to commit. |
The commit disables the autosave endpoints for the global styles in WordPress. Modifications were made to both post.php and class-wp-post-type.php to prevent autosave for the 'wp_global_styles' post type. This ensures that global Styles does not trigger unnecessary autosaves.
This commit removes a comment line in the class-wp-post-type.php file. The deleted comment was linked to the autosave instantiation for the 'wp_global_styles' post types, which is no longer relevant within the current context.
// Disable autosave endpoints for global styles. | ||
'autosave_rest_controller_class' => 'stdClass', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this, add remove_post_type_support( 'wp_global_styles', 'autosave' )
below.
Bumped version from 6.5 to 6.6 in annotations
Closing in favor of #6573 so we can finalize the patch there. |
Trac ticket: https://core.trac.wordpress.org/ticket/60131
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.