-
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
Output post classes in the editor #6716
Conversation
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. |
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: @anton@antons-mac-mini.local. 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. |
$schema['properties']['class_list'] = array( | ||
'description' => __( 'An array of the class names for the post container element.' ), | ||
'type' => 'array', | ||
'context' => array( 'view', 'edit' ), |
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'm not sure about the context.
It seems that 'view' and 'edit' would be appropriate for this field, but I could use some help here. I'd be happy to update the PR if these contexts are not correct for the given field.
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.
Yeah view
and edit
looks correc to me. Basically everything should have edit
, and view
should be used if it's a non-privileged field.
The embed
context is a bit of a bar to meet. It should be used when developers would often need this information when including the resource as an embed. That doesn't seem the case to me here, since the class list would most often be used when looping over the list of posts as a main query.
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.
Thank you for the information. It's indeed very helpful in understanding when to use the embed context.
@@ -2353,6 +2357,15 @@ public function get_item_schema() { | |||
'context' => array( 'edit' ), | |||
'readonly' => true, | |||
); | |||
|
|||
$schema['properties']['class_list'] = array( |
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.
We should add a readonly
keyword.
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.
Good catch. Fixed in e4c1641
Thanks.
aec57a2
to
f8de6e7
Compare
a0b73c1
to
baf2b50
Compare
This reverts commit 48c74a2.
} | ||
|
||
if ( 1 === preg_match( '/^post-\d+$/', $value ) ) { | ||
$data[ $key ] = 'post-1073'; |
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.
What is this? Why is this hardcoded? Is it for test stability? Might be good to comment.
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.
Yes, it's to ensure test stability. Fixed in d24ee39.
P.S. I'll quckly check if hardcoding the value can be avoided. For now, let's just add the comment.
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've discovered an improved method for adding these fixture replacements. While the current implementation works, the approach detailed here offers a better solution: WordPress Core Ticket #61369.
This isn't urgent since the current setup functions adequately for mocking the REST API. However, it would be great if someone could review the new approach when they have time.
Looks good to me to and works. |
See WordPress/gutenberg#60642. See #6716. Fixes #61360. Props antonvlasenko, timothyblynjacobs, ellatrix, oandregal. git-svn-id: https://develop.svn.wordpress.org/trunk@58326 602fd350-edb4-49c9-b593-d223f7449a82
See WordPress/gutenberg#60642. See WordPress/wordpress-develop#6716. Fixes #61360. Props antonvlasenko, timothyblynjacobs, ellatrix, oandregal. Built from https://develop.svn.wordpress.org/trunk@58326 git-svn-id: http://core.svn.wordpress.org/trunk@57783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
See WordPress/gutenberg#60642. See WordPress/wordpress-develop#6716. Fixes #61360. Props antonvlasenko, timothyblynjacobs, ellatrix, oandregal. Built from https://develop.svn.wordpress.org/trunk@58326 git-svn-id: https://core.svn.wordpress.org/trunk@57783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This PR is a backport of WordPress/gutenberg#60642 to WordPress Core.
Trac ticket: https://core.trac.wordpress.org/ticket/61360
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.