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 arg and var names in gutenberg_add_hooked_block
  • Loading branch information
ockham committed Sep 6, 2023
commit 4139d17bb035e5b72119867eb7115d1ed8aa3c00
18 changes: 9 additions & 9 deletions lib/experimental/auto-inserting-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,22 @@ function gutenberg_add_hooked_blocks( $settings, $metadata ) {
*
* @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 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 hooked block next to.
* @param string $hooked_block The name of the block to insert.
* @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 hooked block next to.
* @return void
*/
function gutenberg_add_hooked_block( $inserted_block, $position, $anchor_block ) {
$inserted_block_array = array(
'blockName' => $inserted_block,
function gutenberg_add_hooked_block( $hooked_block, $position, $anchor_block ) {
$hooked_block_array = array(
'blockName' => $hooked_block,
'attrs' => array(),
'innerHTML' => '',
'innerContent' => array(),
'innerBlocks' => array(),
);

$inserter = gutenberg_insert_hooked_block( $inserted_block_array, $position, $anchor_block );
$inserter = gutenberg_insert_hooked_block( $hooked_block_array, $position, $anchor_block );
add_filter( 'gutenberg_serialize_block', $inserter, 10, 1 );

/*
Expand All @@ -212,7 +212,7 @@ function gutenberg_add_hooked_block( $inserted_block, $position, $anchor_block )
* auto-insertion. We're doing so here (i.e. upon block registration), by adding a filter to
* the controller's response.
*/
$controller_extender = gutenberg_add_block_hooks_field_to_block_type_controller( $inserted_block, $position, $anchor_block );
$controller_extender = gutenberg_add_block_hooks_field_to_block_type_controller( $hooked_block, $position, $anchor_block );
add_filter( 'rest_prepare_block_type', $controller_extender, 10, 2 );
}

Expand Down