First of all i'm using acf to create gutenberg blocks (i think it's important to say about it).
I made custom post type for my restaurant menu, where i want to force exactly the same layout for each posts. I made background block to can adding blocks inside there.
<div class="background">
<div class="background-color" style="background-color: <?php echo $background ?>"></div>
<InnerBlocks />
</div>
To get similar layout to each posts i set template parametr in my cpt
'template_lock' => 'all',
'template' => [
['acf/background', ['className' => 'meal_description', 'data' => ['admin_section_name' => 'Meal description']], [
['core/paragraph', ['align' => 'center', 'placeholder' => __('Your block there', 'restaurant')]],
]],
];
Unfortunately when i set template_lock to all i cant add block in my 'inner_blocks" called background. I'm looking for solution in which admin could add some block only in predefined blocks.
Have you tried adding templateLock="false"
to the InnerBlocks
element?
E.g. <InnerBlocks templateLock="false"/>
templateLock
is passed down to child elements, so setting the value on the InnerBlocks
should overwrite the parent value.
If locking is not set in an InnerBlocks area: the locking of the parent InnerBlocks area is used.