admin管理员组文章数量:1130349
I did add a custom block as an InnerBlocks block, called slider. Then i got another custom block slider-item. I think you get the idea.
The slider block just allows slider-item as it's child blocks. Like so:
<InnerBlocks
allowedBlocks={ [ 'ajk/slider-item' ] }
template={[
[ 'ajk/slider-item' ],
[ 'ajk/slider-item' ],
]}
/>
Now I want to achieve that an editor isn't able to use the slider-item outside of my slider container block.
Or is there some kind of repeater block possibility i do miss?!
WP 4.9.8
Gutenberg 4.2.0
I did add a custom block as an InnerBlocks block, called slider. Then i got another custom block slider-item. I think you get the idea.
The slider block just allows slider-item as it's child blocks. Like so:
<InnerBlocks
allowedBlocks={ [ 'ajk/slider-item' ] }
template={[
[ 'ajk/slider-item' ],
[ 'ajk/slider-item' ],
]}
/>
Now I want to achieve that an editor isn't able to use the slider-item outside of my slider container block.
Or is there some kind of repeater block possibility i do miss?!
WP 4.9.8
Gutenberg 4.2.0
- 2 The current documentation is lacking in this regard. Your best bet would be to ask on GitHub. You might get a response from devs - github/WordPress/gutenberg/issues – Ashiquzzaman Kiron Commented Nov 4, 2018 at 9:36
- yes, hard to find right docs at the moment. – André Kelling Commented Nov 5, 2018 at 16:55
1 Answer
Reset to default 7In the slider-item you can specify parent must be slider. That way, the slider-item cannot be used outside of your slider container block.
Something like:
registerBlockType('ajk/slider-item', ...
parent: ['ajk/slider'],
https://wordpress/gutenberg/handbook/block-api/#parent-optional
I did add a custom block as an InnerBlocks block, called slider. Then i got another custom block slider-item. I think you get the idea.
The slider block just allows slider-item as it's child blocks. Like so:
<InnerBlocks
allowedBlocks={ [ 'ajk/slider-item' ] }
template={[
[ 'ajk/slider-item' ],
[ 'ajk/slider-item' ],
]}
/>
Now I want to achieve that an editor isn't able to use the slider-item outside of my slider container block.
Or is there some kind of repeater block possibility i do miss?!
WP 4.9.8
Gutenberg 4.2.0
I did add a custom block as an InnerBlocks block, called slider. Then i got another custom block slider-item. I think you get the idea.
The slider block just allows slider-item as it's child blocks. Like so:
<InnerBlocks
allowedBlocks={ [ 'ajk/slider-item' ] }
template={[
[ 'ajk/slider-item' ],
[ 'ajk/slider-item' ],
]}
/>
Now I want to achieve that an editor isn't able to use the slider-item outside of my slider container block.
Or is there some kind of repeater block possibility i do miss?!
WP 4.9.8
Gutenberg 4.2.0
- 2 The current documentation is lacking in this regard. Your best bet would be to ask on GitHub. You might get a response from devs - github/WordPress/gutenberg/issues – Ashiquzzaman Kiron Commented Nov 4, 2018 at 9:36
- yes, hard to find right docs at the moment. – André Kelling Commented Nov 5, 2018 at 16:55
1 Answer
Reset to default 7In the slider-item you can specify parent must be slider. That way, the slider-item cannot be used outside of your slider container block.
Something like:
registerBlockType('ajk/slider-item', ...
parent: ['ajk/slider'],
https://wordpress/gutenberg/handbook/block-api/#parent-optional
本文标签: How to disallow a certain custom gutenberg block outside of an InnerBlocks block
版权声明:本文标题:How to disallow a certain custom gutenberg block outside of an InnerBlocks block? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749179331a2328331.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论