WordPress/wp-includes/blocks
Felix Arntz fbcb084305 Editor: Allow registering PHP manifest file for block metadata collections for enhanced performance.
Typically, when registering a new block type, its metadata is read from the provided `block.json` file. The more block types are registered on a site, the more costly becomes this process, as it involves filesystem reads and parsing JSON.

WordPress Core's built-in blocks have in the past worked around that by having a auto-generated PHP manifest file that includes the already parsed JSON data for all blocks. This changeset effectively allows plugins to do the same, by introducing a new API function `wp_register_block_metadata_collection()`. The WordPress Core block manifest is now handled using this API as well, rather than custom logic baked into `register_block_type_from_metadata()`.

The `wp_register_block_metadata_collection()` function requires two parameters:
* `$path`: The base path in which block files for the collection reside.
* `$manifest`: The path to the manifest file for the collection.

Every `block.json` file that is supposed to be part of the collection must reside within the provided `$path`, within its own block-specific directory matching the block name (without the block namespace). For example, for a collection `$path` of `/wp-content/plugins/test-plugin` and a block `test-plugin/testimonial`, the block file could be `/wp-content/plugins/test-plugins/blocks/testimonial/block.json`.

It is recommended that plugins use the new API function for enhanced performance, especially if they register several block types. However, the use of the function is entirely optional. Not using it will not result in any difference in user-facing behavior.

Props mreishus, flixos90, gziolo, spacedmonkey, azaozz, mukesh27.
Fixes #62002.

Built from https://develop.svn.wordpress.org/trunk@59132


git-svn-id: http://core.svn.wordpress.org/trunk@58528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 17:08:26 +00:00
..
archives
audio Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
avatar
block Editor: Update packages for 6.6 RC 2. 2024-07-02 14:53:30 +00:00
button Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
buttons Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
calendar
categories Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
code
column Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
columns
comment-author-name Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comment-content Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comment-date Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comment-edit-link Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comment-reply-link Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comment-template Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comments
comments-pagination Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comments-pagination-next
comments-pagination-numbers
comments-pagination-previous
comments-title Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
cover Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
details
embed Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
file Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
footnotes
freeform
gallery Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
group Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
heading Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
home-link
html Editor: Update npm packages. 2024-05-31 18:59:00 +00:00
image Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
latest-comments Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
latest-posts Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
legacy-widget
list Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
list-item Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
loginout Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
media-text Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
missing
more Editor: Update npm packages. 2024-05-31 18:59:00 +00:00
navigation Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
navigation-link Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
navigation-submenu Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
nextpage
page-list
page-list-item
paragraph Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
pattern
post-author Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-author-biography Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-author-name Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-comments-form Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-content Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-date Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-excerpt Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-featured-image Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-navigation-link
post-template
post-terms Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-title Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
preformatted Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
pullquote Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
query Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
query-no-results
query-pagination Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
query-pagination-next
query-pagination-numbers
query-pagination-previous
query-title Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
quote Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
read-more
rss
search Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
separator Editor: Update npm packages. 2024-05-31 18:59:00 +00:00
shortcode
site-logo Editor: Update npm packages. 2024-05-31 18:59:00 +00:00
site-tagline Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
site-title Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
social-link Editor: Update npm packages. 2024-05-31 18:59:00 +00:00
social-links Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
spacer
table Editor: Update packages for 6.6 RC 1. 2024-06-25 13:49:28 +00:00
tag-cloud Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
template-part Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
term-description Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
text-columns
verse Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
video Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
widget-group
archives.php
avatar.php
block.php Editor: Update npm packages. 2024-05-31 18:59:00 +00:00
blocks-json.php Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
button.php Editor: Update npm packages for WP 6.6 Beta 2. 2024-06-11 10:07:32 +00:00
calendar.php
categories.php Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comment-author-name.php
comment-content.php
comment-date.php Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comment-edit-link.php
comment-reply-link.php
comment-template.php
comments-pagination-next.php Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comments-pagination-numbers.php
comments-pagination-previous.php Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
comments-pagination.php
comments-title.php
comments.php Editor: Update npm packages. 2024-05-31 18:59:00 +00:00
cover.php
file.php Editor: Update packages for 6.7 Beta 1. 2024-09-23 06:52:26 +00:00
footnotes.php
gallery.php
heading.php
home-link.php
image.php Editor: Update packages for 6.7 Beta 1. 2024-09-23 06:52:26 +00:00
index.php Editor: Allow registering PHP manifest file for block metadata collections for enhanced performance. 2024-09-30 17:08:26 +00:00
latest-comments.php
latest-posts.php
legacy-widget.php
list.php
loginout.php
media-text.php Editor: Add plugin template registration API and improve theme overrides for plugin-registered templates 2024-09-20 02:07:12 +00:00
navigation-link.php
navigation-submenu.php
navigation.php Editor: Update packages for 6.7 Beta 1. 2024-09-30 05:11:31 +00:00
page-list-item.php
page-list.php Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
pattern.php
post-author-biography.php
post-author-name.php
post-author.php
post-comments-form.php
post-content.php
post-date.php Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
post-excerpt.php
post-featured-image.php
post-navigation-link.php
post-template.php Editor: Update packages for 6.7 Beta 1. 2024-09-23 06:52:26 +00:00
post-terms.php
post-title.php
query-no-results.php
query-pagination-next.php Editor: Update npm packages for WP 6.6 Beta 2. 2024-06-11 10:07:32 +00:00
query-pagination-numbers.php
query-pagination-previous.php Editor: Update npm packages for WP 6.6 Beta 2. 2024-06-11 10:07:32 +00:00
query-pagination.php
query-title.php
query.php Editor: Update packages for 6.7 Beta 1. 2024-09-23 06:52:26 +00:00
read-more.php
require-dynamic-blocks.php Editor: Update npm packages for WP 6.6 Beta 2. 2024-06-11 10:07:32 +00:00
require-static-blocks.php Editor: Update npm packages for WP 6.6 Beta 2. 2024-06-11 10:07:32 +00:00
rss.php
search.php Editor: Update packages for 6.7 Beta 1. 2024-09-23 06:52:26 +00:00
shortcode.php
site-logo.php Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
site-tagline.php
site-title.php
social-link.php Editor: Update npm packages. 2024-05-31 18:59:00 +00:00
tag-cloud.php Editor: Update packages for 6.7 Beta 1. 2024-09-20 01:55:35 +00:00
template-part.php Update packages to include latest changes. 2024-06-24 18:38:18 +00:00
term-description.php
widget-group.php