-
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 Extensibility: Allow unregistering the duplicate pattern action #64373
Conversation
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. |
Size Change: +72 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
@@ -37,7 +37,7 @@ const exportPattern: Action< Pattern > = { | |||
id: 'export-pattern', | |||
label: __( 'Export as JSON' ), | |||
supportsBulk: true, | |||
isEligible: ( item ) => item.type === 'wp_block', | |||
isEligible: ( item ) => item.type !== 'wp_template_part', |
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 is to relax the check and allow non user patterns to be exported right? I tested a bit and didn't see any issues with this. I'm wondering though why we had that restriction before..
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 it was probably a mistake that I did before when I ported this action. I don't see why we shouldn't be exporting "theme patterns".
That said, ideally, we should have the same "type" for both theme and user patterns but that's a bigger/separate project.
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.
Actually there is an issue if you try to import such a pattern afterwards. I remember seeing some logic about __file:pattern
during import.
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.
Interesting, ok, I'll remove that change then.
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!
const canCreate = await registry | ||
.resolveSelect( coreStore ) | ||
.canUser( 'create', { | ||
kind: 'postType', | ||
name: 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.
This probably needs to be available as part of an item's permissions
object.
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 to be honest but I can be convinced :P
The permissions
are specific to the current item
. This is not, this is the ability to create an item.
…tion (#64373) Co-authored-by: youknowriad <[email protected]> Co-authored-by: ntsekouras <[email protected]>
Related #61084
Similar to #62647
What?
In #62052 an API to register and unregister dataviews actions has been implemented. But in order to allow third-party developers to be able to unregister these actions, we need to be using the same actions in Core to register the core actions. The current PR explore the possibility to use the API to register one action: "duplicate pattern".
Testing Instructions
1- Open the patterns dataviews.
2- You should be able to see the "duplicate" action in the actions dropdown menu for theme and user patterns.
3- you can try to use the action.