Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename "auto inserting blocks" to "block hooks" #54147

Merged
merged 37 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions lib/compat/wordpress-6.3/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ function add_modified_wp_template_schema() {
}
add_filter( 'rest_api_init', 'add_modified_wp_template_schema' );

// If the Auto-inserting Blocks experiment is enabled, we load the block patterns
// If the Block Hooks experiment is enabled, we load the block patterns
// controller in lib/experimental/rest-api.php instead.
if ( ! gutenberg_is_experiment_enabled( 'gutenberg-auto-inserting-blocks' ) ) {
if ( ! gutenberg_is_experiment_enabled( 'gutenberg-block-hooks' ) ) {
/**
* Registers the block patterns REST API routes.
*/
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Gutenberg_REST_Block_Patterns_Controller extends Gutenberg_REST_Block_Patt
*/
public function prepare_item_for_response( $item, $request ) {
$response = parent::prepare_item_for_response( $item, $request );
if ( ! gutenberg_is_experiment_enabled( 'gutenberg-auto-inserting-blocks' ) ) {
if ( ! gutenberg_is_experiment_enabled( 'gutenberg-block-hooks' ) ) {
return $response;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/experimental/editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function gutenberg_enable_experiments() {
wp_add_inline_script( 'wp-block-library', 'window.__experimentalDisableTinymce = true', 'before' );
}

if ( $gutenberg_experiments && array_key_exists( 'gutenberg-auto-inserting-blocks', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalAutoInsertingBlocks = true', 'before' );
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-block-hooks', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalBlockHooks = true', 'before' );
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/experimental/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
die( 'Silence is golden.' );
}

if ( gutenberg_is_experiment_enabled( 'gutenberg-auto-inserting-blocks' ) ) {
if ( gutenberg_is_experiment_enabled( 'gutenberg-block-hooks' ) ) {
/**
* Registers the block patterns REST API routes.
*/
Expand Down
8 changes: 4 additions & 4 deletions lib/experiments-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ function gutenberg_initialize_experiments_settings() {
);

add_settings_field(
'gutenberg-auto-inserting-blocks',
__( 'Auto-inserting blocks', 'gutenberg' ),
'gutenberg-block-hooks',
__( 'Block hooks', 'gutenberg' ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An important note: remember to enable the experiment again before testing these changes. It took me a while to realize that.

'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Test Auto-inserting blocks', 'gutenberg' ),
'id' => 'gutenberg-auto-inserting-blocks',
'label' => __( 'Block hooks allow automatically inserting a block in a position relative to another.', 'gutenberg' ),
'id' => 'gutenberg-block-hooks',
)
);

Expand Down
6 changes: 3 additions & 3 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require_once __DIR__ . '/experimental/class-wp-rest-customizer-nonces.php';
}
require_once __DIR__ . '/experimental/class-gutenberg-rest-template-revision-count.php';
if ( gutenberg_is_experiment_enabled( 'gutenberg-auto-inserting-blocks' ) ) {
if ( gutenberg_is_experiment_enabled( 'gutenberg-block-hooks' ) ) {
require_once __DIR__ . '/experimental/class-gutenberg-rest-block-patterns-controller.php';
}
require_once __DIR__ . '/experimental/rest-api.php';
Expand Down Expand Up @@ -110,8 +110,8 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/experimental/disable-tinymce.php';
}

if ( gutenberg_is_experiment_enabled( 'gutenberg-auto-inserting-blocks' ) ) {
require __DIR__ . '/experimental/auto-inserting-blocks.php';
if ( gutenberg_is_experiment_enabled( 'gutenberg-block-hooks' ) ) {
require __DIR__ . '/experimental/block-hooks.php';
}
require __DIR__ . '/experimental/interactivity-api/class-wp-interactivity-store.php';
require __DIR__ . '/experimental/interactivity-api/store.php';
Expand Down
271 changes: 0 additions & 271 deletions packages/block-editor/src/hooks/auto-inserting-blocks.js

This file was deleted.

Loading