wp_register_block_types_from_metadata_collection()
Registers all block types from a block metadata collection.
This can either reference a previously registered metadata collection or, if the $manifest parameter is provided, register the metadata collection directly within the same function call.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wp_register_block_types_from_metadata_collection( $path, $manifest );
- $path(строка) (обязательный)
- The absolute base path for the collection ( e.g., WP_PLUGIN_DIR . '/my-plugin/blocks/' ).
- $manifest(строка)
- The absolute path to the manifest file containing the metadata collection, in order to register the collection. If this parameter is not provided, the $path parameter must reference a previously registered block metadata collection.
По умолчанию: ''
Заметки
- Смотрите: wp_register_block_metadata_collection()
- Смотрите: register_block_type_from_metadata()
Список изменений
С версии 6.8.0 | Введена. |
Код wp_register_block_types_from_metadata_collection() wp register block types from metadata collection WP 6.8.1
function wp_register_block_types_from_metadata_collection( $path, $manifest = '' ) { if ( $manifest ) { wp_register_block_metadata_collection( $path, $manifest ); } $block_metadata_files = WP_Block_Metadata_Registry::get_collection_block_metadata_files( $path ); foreach ( $block_metadata_files as $block_metadata_file ) { register_block_type_from_metadata( $block_metadata_file ); } }