admin管理员组文章数量:1122846
Is there a way of preventing the use of a certain block variation inside a specific parent block?
I have an "inner blocks" block that is basically a group block but without any settings, it's just a container for inner blocks. I have another block that is almost the same thing except it has one attribute. I would like to just use the first block, and add the second as a variation, but only allow the variation to be used inside one specific parent block.
Is this doable?
Is there a way of preventing the use of a certain block variation inside a specific parent block?
I have an "inner blocks" block that is basically a group block but without any settings, it's just a container for inner blocks. I have another block that is almost the same thing except it has one attribute. I would like to just use the first block, and add the second as a variation, but only allow the variation to be used inside one specific parent block.
Is this doable?
Share Improve this question asked Sep 11, 2023 at 12:46 Markus FinellMarkus Finell 1212 bronze badges1 Answer
Reset to default 0A variation is a representation of the original block.
if block-1 allows the insertion of block-2; then block-1 will except all variations of block-2.
core/columns
only allows the insertion of a core/column
.
- If I create a variation of
core/column
I would expect thecore/column
to accept my variation. - And therefor the reverse should also to be expected.
but… block.json
offers the blockHook key which might offer a workaround of sorts
"blockHooks": {
"acme/dialog": "firstChild"
}
P.S. This answer by Tom J Nowell goes into additional aspects and is quite enlightening
本文标签: Prevent block variation inside certain parent blocks
版权声明:本文标题:Prevent block variation inside certain parent blocks 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736289783a1928379.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论