Volto - How do you edit an existing block's schema?

For example, if I am shadowing the View.jsx for a block from an addon and some of the settings for that block are no longer applicable with the new UI, do I need to shadow the entire edit block and create a new BlockDataForm? I have tried to use schema extenders (code below) to remove a property, but this just seems to throw an exception when you try to edit the block:

config.blocks.blocksConfig.accordion.schemaEnhancer = ({ schema }) => {
    delete schema.properties.non_exclusive;
    return schema;

The problem is that a field id is referenced in two places: the schema.properties and schema.fieldsets[0].fields (or any other fieldset instead of 0)

To hide the field you have to remove it from the fields array, not the properties.

1 Like

Works great, thanks! Is this the 'recommended' way of achieving this then?

It's fine. That's why the schemaEnhancer is a function, so you can do whatever to the schema.

1 Like

Plone Foundation Code of Conduct