wordpress-develop/tests/phpunit/tests/blocks
bernhard-reiter a92aa29daf Block Hooks: Introduce a new hooked_block_{$block_type} filter.
Add a new `hooked_block_{$block_type}` filter that allows modifying a hooked block (in parsed block format) prior to insertion, while providing read access to its anchor block (in the same format).

This allows block authors to e.g. set a hooked block's attributes, or its inner blocks; the filter can peruse information about the anchor block when doing so. As such, this filter provides a solution to both #59572 and #60126.

The new filter is designed to strike a good balance and separation of concerns with regard to the existing [https://developer.wordpress.org/reference/hooks/hooked_block_types/ `hooked_block_types` filter], which allows addition or removal of a block to the list of hooked blocks for a given anchor block -- all of which are identified only by their block ''types''. This new filter, on the other hand, only applies to ''one'' hooked block at a time, and allows modifying the entire (parsed) hooked block; it also gives (read) access to the parsed anchor block.

Props gziolo, tomjcafferkey, andrewserong, isabel_brison, timbroddin, yansern.
Fixes #59572, #60126.

git-svn-id: https://develop.svn.wordpress.org/trunk@57354 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-25 13:46:49 +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: Introduce a new hooked_block_{$block_type} filter. 2024-01-25 13:46:49 +00:00
getHookedBlocks.php Block Hooks: Fix @ticket references in tests, add missing ones. 2023-12-08 11:44:54 +00:00
insertHookedBlocks.php Block Hooks: Introduce a new hooked_block_{$block_type} filter. 2024-01-25 13:46:49 +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