[wp-trac] [WordPress Trac] #62267: Allow registering block type collections with a single function call
WordPress Trac
noreply at wordpress.org
Mon Oct 21 20:35:08 UTC 2024
#62267: Allow registering block type collections with a single function call
-------------------------+--------------------------
Reporter: flixos90 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.8
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: | Focuses: performance
-------------------------+--------------------------
Comment (by flixos90):
What @gziolo @mreishus and I discussed in Slack so far was to potentially
add a flag to the new function, e.g. like so:
{{{#!php
wp_register_block_metadata_collection(
WP_PLUGIN_DIR . '/my-block-library/build',
WP_PLUGIN_DIR . '/my-block-library/build/blocks-manifest.php',
array( 'auto_register' => true )
);
}}}
This alone would be a quite straightforward change to make and already
address what's outlined in the ticket.
Additionally though, there would be value in combining the block type
asset metadata into this process as well. Today, many block type assets
still need to be individually registered, and block types only reference
the asset handles registered in PHP. For the registration, it is already
established to generate files with the metadata (`{file}.asset.php`), so
potentially this could be integrated into `block.json` files (and thus
also the built PHP manifest) to simplify scaffolding a block, and in
particular the block registration code needed, even more. See related
Gutenberg issue https://github.com/WordPress/gutenberg/issues/46954.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62267#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list