WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.32k stars 4.12k forks source link

Allow to disable settings for specific blocks #38767

Open vyskoczilova opened 2 years ago

vyskoczilova commented 2 years ago

What problem does this address?

Please, think about tailor-made themes that are coded from design to WordPress.

We need to control block settings being to able to turn off user's modifications like Layout and Width panels (and other "new features"). There is no way to turn them off and they are causing many headaches - clients call you "why it doesn't work in our theme", but the designer hasn't prepared those options. And the reason why this happens is that the new WordPress is released. I mean - I want to use the latest release, but I don't want to use certain features that are not ready in design.

I haven't found a way to do it.

Looks like it's related to #19796 that was never solved.

What is your proposed solution?

Add theme.json settings that will easily allow setting panels off - in settings for all blocks, in blocks for separate blocks. I believe that theme.json should be the place for all edits. That would enable to quickly disable unwanted features and at the same time keep latest WP version.

fabiankaegy commented 2 years ago

This is also something that comes up again and again on client builds. The ability to control which settings get presented to the editor via a mechanism like theme.json already is great for all the settings that can be shown/hidden that way. The width settings panel of the button block is one of the few remaining ones that doesn't have a way to show/hide it.

In a way, I see this setting as similar to the dropCap setting. It doesn't really have a reason to exist at a global scale because the only block that actually implements it is the core/paragraph block. But it still exists as an option in theme.json.

The way this could be done without refactoring the width setting to be a block support like all the other settings, would be by using useSetting( 'layout.width' )