Can blocks be transformed into block variations?
-
Hi! I have a simple Block Variation for core/heading –
wp.blocks.registerBlockVariation( 'core/heading', [{ name: 'my heading', title: 'My Heading', attributes: { level: 3, className: 'is-style-my-heading', }, scope: [ 'inserter', 'block', 'transform' ], }] );
It works in the inserter, but I can’t make the variation visible in the transforms component for some reason. But maybe I don’t sufficiently understand what the ‘transform’ in the scope attribute is supposed to do. I can transform the block variation to, say, a paragraph (not the core version of heading for some reason), but when I try to transform a paragraph or a core heading the list of available transforms only gives the core/heading block (or none), not the variation.
Can only one core/heading block be in the transforms list and thus variations will only appear if they are assigned as “default” variation?
Is that expected behavior? Seems strange to me, why shouldn’t I be able to transform a paragraph into a specific version of the headline?
- The topic ‘Can blocks be transformed into block variations?’ is closed to new replies.