wordpress-develop/tests/phpunit/tests/blocks
Joe McGill 5815624ead Editor: Support deferred block variation initialization on the server.
When registering blocks on the server using `register_block_type()` or similar functions, a set of block type variations can also be registered. However, in some cases building this variation data during block registration can be an expensive process, which is not needed in most contexts. 

To address this problem, this adds support to the `WP_Block_Type` object for a new property, `variation_callback`, which can be used to register a callback for building variation data only when the block variations data is needed. The `WP_Block_Type::variations` property has been changed to a private property that is now accessed through the magic `__get()` method. The magic getter makes use of a new public method, `WP_Block_Type::get_variations` which will build variations from a registered callback if variations have not already been built.

Props spacedmonkey, thekt12, Mamaduka, gaambo, gziolo, mukesh27, joemcgill.
Fixes #59969.


git-svn-id: https://develop.svn.wordpress.org/trunk@57315 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-19 20:52:06 +00:00
..
editor.php Script Loader: Replace hardcoded output of style tags with calls to wp_add_inline_style. 2023-09-25 17:04:41 +00:00
getBlockAssetUrl.php Coding Standards: Fix a few newly introduced WPCS issues. 2023-09-26 00:07:56 +00:00
getBlockTemplates.php Tests: Improve the @group annotation accuracy and consistency. 2023-10-19 13:51:04 +00:00
getHookedBlockMarkup.php Block Hooks: Fix @ticket references in tests, add missing ones. 2023-12-08 11:44:54 +00:00
getHookedBlocks.php Block Hooks: Fix @ticket references in tests, add missing ones. 2023-12-08 11:44:54 +00:00
register.php Block Types: Add metadata global attribute. 2023-11-06 14:45:28 +00:00
registerCoreBlockStyleHandles.php Editor: Correctly load RTL stylesheets in register_core_block_style_handles(). 2023-10-30 12:52:44 +00:00
render.php Blocks: Fix layout support to be compatible with enhanced pagination. 2023-10-24 08:49:38 +00:00
renderBlock.php Tests: Rename and improve the blocks/context.php file to follow handbook 2023-10-03 08:52:54 +00:00
renderCommentTemplate.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
renderReusable.php Docs: Update some reusable block references to synced patterns. 2023-10-31 12:56:16 +00:00
serialize.php Blocks: During traversal, allow post callback to modify block. 2023-10-18 19:30:40 +00:00
supportedStyles.php Editor: Lazily load Duotone settings only when needed. 2023-07-13 11:32:19 +00:00
wpBlock.php Block Types: Add metadata global attribute. 2023-11-06 14:45:28 +00:00
wpBlockList.php Coding Standards: Use pre-increment/decrement for stand-alone statements. 2023-09-09 09:26:01 +00:00
wpBlockParser.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
wpBlockPatternsRegistry.php Block Hooks: Fix @ticket references in tests, add missing ones. 2023-12-08 11:44:54 +00:00
wpBlockType.php Editor: Support deferred block variation initialization on the server. 2024-01-19 20:52:06 +00:00
wpBlockTypeRegistry.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00