Skip to content

Commit

Permalink
Rename "auto inserting blocks" to "block hooks" (#54147)
Browse files Browse the repository at this point in the history
See #53987 (comment):

> I've seen anecdotal feedback that `autoInsert` is not the clearest of descriptions. I'd like to propose renaming to the more familiar `hooks` terminology—and "block hooks" in more general terms—to help folks understand the mechanics and purpose more rapidly.
  • Loading branch information
ockham committed Sep 6, 2023
1 parent 012a6b3 commit d62508d
Show file tree
Hide file tree
Showing 15 changed files with 407 additions and 414 deletions.
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' ),
'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 @@ -70,7 +70,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 @@ -136,8 +136,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

0 comments on commit d62508d

Please sign in to comment.