2

I am using a template for InnerBlocks and adding predefined attributes like heading level and paragraph placeholder:

const MY_TEMPLATE = [
    [ 'core/image', {} ],
    [ 'core/heading', { level: 3 } ],
    [ 'core/paragraph', { placeholder: 'Summary' } ],
];
 
//...
 
    edit: () => {
        return (
            <InnerBlocks
                template={ MY_TEMPLATE }
                templateLock="all"
            />
        );
    },

This works well but how can we add predefined values for block supports?

For example when registering a block I can set support values:

supports: {      
    className: false // Remove the support for the generated className.
    color: { // Text UI control is enabled.
        background: false, // Disable background UI control.
        gradients: true // Enable gradients UI control.
    }
}

How can I set values for supports through InnerBlocks templates? For example I want to remove the default wp-block- class name from a block. I tried:

const MY_TEMPLATE = [
  [ 'my-block/icon', { supports: { classname: false } } ],
  [ 'core/heading', {} ]
];

The supports is not passed to the block. How can I make this work? Or is there another way.

Note: I have to do this only through InnerBlocks templates. Or maybe determine if the block is part of innerblocks and add the support values.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.