-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,7 +128,7 @@ export const registerPostTypeSchema = | |
|
||
const actions = [ | ||
postTypeConfig.viewable ? viewPost : undefined, | ||
!! postTypeConfig?.supports?.revisions | ||
!! postTypeConfig.supports?.revisions | ||
? viewPostRevisions | ||
: undefined, | ||
// @ts-ignore | ||
|
@@ -148,7 +148,7 @@ export const registerPostTypeSchema = | |
? duplicatePattern | ||
: undefined, | ||
postTypeConfig.supports?.title ? renamePost : undefined, | ||
postTypeConfig?.supports?.[ 'page-attributes' ] | ||
postTypeConfig.supports?.[ 'page-attributes' ] | ||
? reorderPage | ||
: undefined, | ||
postTypeConfig.slug === 'wp_block' ? exportPattern : undefined, | ||
|
@@ -157,25 +157,24 @@ export const registerPostTypeSchema = | |
deletePost, | ||
trashPost, | ||
permanentlyDeletePost, | ||
]; | ||
].filter( Boolean ); | ||
|
||
const fields = [ | ||
featuredImageField, | ||
postTypeConfig.supports?.thumbnail && | ||
currentTheme?.[ 'theme-supports' ]?.[ 'post-thumbnails' ] && | ||
featuredImageField, | ||
titleField, | ||
authorField, | ||
postTypeConfig.supports?.author && authorField, | ||
statusField, | ||
dateField, | ||
slugField, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, you can check the different There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you're right :) |
||
parentField, | ||
commentStatusField, | ||
postTypeConfig.supports?.[ 'page-attributes' ] && parentField, | ||
postTypeConfig.supports?.comments && commentStatusField, | ||
passwordField, | ||
]; | ||
].filter( Boolean ); | ||
|
||
registry.batch( () => { | ||
actions.forEach( ( action ) => { | ||
if ( ! action ) { | ||
return; | ||
} | ||
unlock( registry.dispatch( editorStore ) ).registerEntityAction( | ||
'postType', | ||
postType, | ||
|
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.