-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block API: Extend
register_block_type_from_metadata
to handle assets (
#22519) * Blocks: Extend `register_block_type_from_metadata` to hanle assets The proposed approach follows the solution proposed in Block Registration RFC. * Update lib/compat.php Co-authored-by: Andrew Duthie <andrew@andrewduthie.com> * Map explicitly from metadata to settings to filter out unwanted fields * Improve error handling by following register from the WP_Block_Type_Registry * Update unit tests for register_block_from_metadata * Add handling for scripts/style handles and paths * Remove styleVariations alias in favor of the supported styles property * Improve readability of the metada file path handling * Introduce helper functions for working with asset files * Docs: Reflect proposed changes for block.json handling of asset files' * Correct the way asset paths are handled * Add missing example field in block metadata processing * Add basic unit tests to cover functions that register handles * Add more tests covering automatic block asset registration Co-authored-by: Andrew Duthie <andrew@andrewduthie.com>
- Loading branch information
Showing
8 changed files
with
423 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.