-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
DataViews: Update usePostFields
to accept postType
#67380
Conversation
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
featuredImageField, | ||
postTypeConfig.supports?.thumbnail && | ||
currentTheme?.[ 'theme-supports' ]?.[ 'post-thumbnails' ] && | ||
featuredImageField, | ||
titleField, |
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 intentionally didn't add the post type supports for title here, as I need to investigate better how core lists (wp-admin) handles it and what we should do here.
Additionally it relates to the issue about layout fields I mentioned in the PR's description. Some layouts declare this as primary 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.
Can you add a TODO in the code so we don't forget? Let's ship this.
Size Change: +64 B (0%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
featuredImageField, | ||
postTypeConfig.supports?.thumbnail && | ||
currentTheme?.[ 'theme-supports' ]?.[ 'post-thumbnails' ] && | ||
featuredImageField, | ||
titleField, | ||
authorField, | ||
statusField, | ||
dateField, | ||
slugField, |
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 one has a support key too.
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.
The slug
?
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, you can check the different <PostTypeSupportCheck
calls we have to find these.
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.
Hm.. the docs for supports don't say that.. Are you sure there is such support?
I saw we have a <PostTypeSupportCheck supportKeys="slug">
check, but I don't think it ever worked properly - unless there was such support in the past. Also I think the above code might not being used anywhere by quickly adding a breakpoint there. I'll check more to see if we can remove that code.
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 think you're right :)
I see there's a |
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.
Thanks! :)
I'm seeing some weirds things (quickedit not opening, click behavior for table) but they also happen in trunk
. See report in core-editor slack channel.
Co-authored-by: ntsekouras <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: oandregal <[email protected]>
Co-authored-by: ntsekouras <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: oandregal <[email protected]>
What?
Part of: #61084
This PR updates
usePostFields
to accept postType and add some support checks to conditionally add some fields, like featured image.This surfaces some issues we need to solve regarding layouts using some fields that might not exist. For example to handle when we don't support
featured image
butview.layout.mediaField
is declared to show that. These should be handled in follow ups to iterate faster.Testing Instructions
wp.editor.unregisterEntityField( 'postType', 'page', 'author' );
orwp.editor.unregisterEntityField( 'postType', 'post', 'author' );
in the respective DataViews lists