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
In 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