Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7c9af07
Rename block.json field to __experimentalBlockHooks
ockham Sep 4, 2023
8dd9ed6
Update comment
ockham Sep 4, 2023
4325bef
Rename window. flag for experiment
ockham Sep 4, 2023
7b2e498
Rename Gutenberg experiment
ockham Sep 4, 2023
24e5119
Update GB experiment title and label
ockham Sep 4, 2023
33b84b2
Change classname
ockham Sep 4, 2023
a2ea218
Rename component
ockham Sep 4, 2023
5fb3202
Rename two variables
ockham Sep 4, 2023
89bb600
Rename more variables
ockham Sep 4, 2023
2bcf644
Comment wording
ockham Sep 4, 2023
8e7193e
Change hooked blocks block hook name :dizzy:
ockham Sep 4, 2023
282909a
Change HOC name
ockham Sep 4, 2023
6fa67be
s/gutenberg_register_auto_inserted_block/gutenberg_add_hooked_block/g
ockham Sep 4, 2023
ac87ee2
s/gutenberg_register_auto_inserted_blocks/gutenberg_add_hooked_blocks/g
ockham Sep 4, 2023
0d2cf6a
s/gutenberg_auto_insert_block/gutenberg_insert_hooked_block/g
ockham Sep 4, 2023
130b5d8
Change blocks controller field name
ockham Sep 4, 2023
bad8e9b
Change server block settings field name
ockham Sep 4, 2023
da434a2
s/gutenberg_register_auto_insert_rest_field/gutenberg_register_block_…
ockham Sep 4, 2023
2773ff8
Change variable name
ockham Sep 4, 2023
5943b7e
Update _doing_it_wrong message
ockham Sep 4, 2023
2d1d808
Update PHPDoc for gutenberg_add_hooked_block
ockham Sep 4, 2023
a48ddca
Update file's PHPDoc
ockham Sep 4, 2023
4139d17
Update arg and var names in gutenberg_add_hooked_block
ockham Sep 4, 2023
8173a09
Update PHPDoc for gutenberg_add_hooked_blocks
ockham Sep 4, 2023
bce1ad5
Tweak PHPDoc for gutenberg_add_hooked_block
ockham Sep 4, 2023
0d1667a
More updates to gutenberg_add_hooked_block inline PHPDoc
ockham Sep 4, 2023
b7a83ec
Update PHPDoc for gutenberg_insert_hooked_block
ockham Sep 4, 2023
d8663a0
Move helper functions below public API functions
ockham Sep 4, 2023
540b966
Change PHP file name
ockham Sep 4, 2023
3fa0ceb
Rename block property
ockham Sep 4, 2023
59c7055
Comment wording
ockham Sep 4, 2023
e14313e
Rename JS file
ockham Sep 4, 2023
4d05faf
Rename SCSS file
ockham Sep 4, 2023
09f7938
Update comment
ockham Sep 4, 2023
f6302a2
Typo
ockham Sep 4, 2023
c3622d6
Another typo
ockham Sep 4, 2023
ca5331b
Streamline names in JS file
ockham Sep 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update PHPDoc for gutenberg_add_hooked_block
  • Loading branch information
ockham committed Sep 6, 2023
commit 2d1d80832241f416a70c40065d5a8d8b2b06e9c7
16 changes: 9 additions & 7 deletions lib/experimental/auto-inserting-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,22 @@ function gutenberg_add_hooked_blocks( $settings, $metadata ) {
add_filter( 'block_type_metadata_settings', 'gutenberg_add_hooked_blocks', 10, 2 );

/**
* Register block for auto-insertion into the frontend and REST API.
* Add a block to a given block hook.
*
* Register a block for auto-insertion into the frontend and into the markup
* A block hook is specified by a block type and a relative position. The hooked block
* will be automatically inserted in the given position next to the "anchor" block
* whenever the latter is encountered. This applies both to the frontend and to the markup
* returned by the templates and patterns REST API endpoints.
*
* This is currently done by filtering parsed blocks as obtained from a block template
* template part, or pattern and injecting the auto-inserted block where applicable.
* This is currently done by filtering parsed blocks as obtained from a block template,
* template part, or pattern, and injecting the hooked block where applicable.
*
* @todo In the long run, we'd likely want some sort of registry for auto-inserted blocks.
* @todo In the long run, we'd likely want some sort of registry for hooked blocks.
*
* @param string $inserted_block The name of the block to insert.
* @param string $position The desired position of the auto-inserted block, relative to its anchor block.
* @param string $position The desired position of the hooked block, relative to its anchor block.
* Can be 'before', 'after', 'first_child', or 'last_child'.
* @param string $anchor_block The name of the block to insert the auto-inserted block next to.
* @param string $anchor_block The name of the block to insert the hooked block next to.
* @return void
*/
function gutenberg_add_hooked_block( $inserted_block, $position, $anchor_block ) {
Expand Down