Skip to content
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

Allow Disabling of Synced Pattern Overrides (dynamically) #62338

Open
MadtownLems opened this issue Jun 5, 2024 · 5 comments
Open

Allow Disabling of Synced Pattern Overrides (dynamically) #62338

MadtownLems opened this issue Jun 5, 2024 · 5 comments
Labels
[Feature] Block bindings [Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Enhancement A suggestion for improvement.

Comments

@MadtownLems
Copy link

What problem does this address?

While we are very excited about the possibilities of Synced Pattern Overrides, it feels like a very advanced topic that we'd like to prevent our content providers from creating on their own (at least for now). We also imagine a world where Network Administrators can create them (and content providers could use them)

What is your proposed solution?

Allow the ability to create patterns that contain overrides to be removed with a filter, such as with block_editor_settings_all (https://developer.wordpress.org/reference/hooks/block_editor_settings_all/). This would allow us the ability to let Network Administrators create them, but typical users could only use them.

@MadtownLems MadtownLems added the [Type] Enhancement A suggestion for improvement. label Jun 5, 2024
@talldan talldan added [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Feature] Block bindings labels Jun 6, 2024
@talldan
Copy link
Contributor

talldan commented Jun 6, 2024

As pattern overrides are implemented using the block binding API, I'll also add the 'Block bindings' label to this. It could potentially be a block bindings feature rather than specific to patterns.

@talldan talldan added the [Feature] Extensibility The ability to extend blocks or the editing experience label Jun 6, 2024
@SantosGuillamot
Copy link
Contributor

It seems there are different use cases here that might affect the potential implementation:

  • Conditionally disallow "Synced Pattern" creation.
  • Conditionally disallow the "Overrides" option from synced patterns.
  • Conditionally disallow the editing of the overridable values when a synced pattern with overrides has already been created.

The first two points seem specific to the Synced Patterns UI, which does not use bindings.

For the last one, I assume that if a user has the permissions to edit the post where the pattern is inserted, they should be able to edit the overridable values. And if they don't have permissions, they shouldn't. Is that right?

@kraftner
Copy link

Related: #28895 (comment)

@talldan
Copy link
Contributor

talldan commented Aug 26, 2024

The first two points seem specific to the Synced Patterns UI, which does not use bindings.

The first is really #28895. Patterns (wp_block post types) need their own distinct capabilities to enable that.

The second is more nuanced (hiding the Enable/Disable overrides button), and I think that's what this issue is about. In my mind this is more closely related to bindings.

For example, it might be that in the future extenders can configure which blocks support which bindings, and that could be one way to achieve this. Whether it disables the UI for enabling bindings or completely prevents the bindings from working at all is another matter. The second option is dangerous as it can completely change a site's content if they already have active bindings.

It could also be that there's some config in the binding source to prevent the UI from showing, though perhaps that's only for the default bindings UI.

There's also the possibility of unregistering the binding source completely.

For the last one, I assume that if a user has the permissions to edit the post where the pattern is inserted, they should be able to edit the overridable values. And if they don't have permissions, they shouldn't. Is that right?

Yep, that's correct.

@gziolo
Copy link
Member

gziolo commented Sep 9, 2024

Linking the related issue that proposes adding meta capability for Pattern Overrides:

Speaking of Block Bindings, there was recently a block editor setting introduced that controls whether the user should be able to manage Block Bindings through UI:

There is a follow-up work that explores adding meta capability to add more control on the server:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block bindings [Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

5 participants