-
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
WIP REST API: Add revision count and links to template parts #3476
Conversation
Hi @georgeh! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in this blog post. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
@@ -752,6 +752,23 @@ protected function prepare_links( $id ) { | |||
), | |||
); | |||
|
|||
$template = get_block_template( $id, $this->post_type ); | |||
$revisions = wp_get_latest_revision_id_and_total_count( $template->wp_id ); |
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.
Not all templates will. have a wp_id.
My goal is to let the template editor know if there are previous revisions so that it can choose whether or not to display the revision link. Right now I'm trying to get the template and template-part revision REST APIs to mimic the post APIs, but routing is a challenge. The templates REST controller [accepts more-or-less anything after I don't want to get in a situation where you have to name your template a special reserved word. I am currently experimenting with making I'm tempted to go ahead with the quick solution and just add the revision count to the template response, without including any links to previous revisions. This would allow us to move forward on WordPress/gutenberg#44503 but creates a special case for templates. |
Making the changes in WordPress/gutenberg#45215 instead |
This adds revision information for template parts, which will be needed for WordPress/gutenberg#44503
TODO
Trac ticket:
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.