The Problem
There is a Gutenberg\BlockInterface, and a common way of creating one seems to be by using a map returned by parse_blocks(). Unfortunately, there's nothing right now that could allow the creation of a block from such a map. There's no way at all to abstract block initialization.
Suggested Solution
The Problem
There is a
Gutenberg\BlockInterface, and a common way of creating one seems to be by using a map returned byparse_blocks(). Unfortunately, there's nothing right now that could allow the creation of a block from such a map. There's no way at all to abstract block initialization.Suggested Solution
BlockFactoryInterfacethat would accept the key parameters for blocks separately and with proper type declarations.ConfigBasedBlockFactoryInterfacethat would accept anarraymap of values from one of the items ofparse_blocks(). This allows easy creation from configuration, based on WP config key conventions.