diff --git a/backport-changelog/7.0/10909.md b/backport-changelog/7.0/10909.md index bc073ee61e6c41..60b904d5a9a9e6 100644 --- a/backport-changelog/7.0/10909.md +++ b/backport-changelog/7.0/10909.md @@ -3,3 +3,4 @@ https://github.com/WordPress/wordpress-develop/pull/10909 * https://github.com/WordPress/gutenberg/pull/72215 * https://github.com/WordPress/gutenberg/pull/74943 * https://github.com/WordPress/gutenberg/pull/75526 +* https://github.com/WordPress/gutenberg/pull/75576 diff --git a/lib/experimental/class-wp-icons-registry.php b/lib/compat/wordpress-7.0/class-wp-icons-registry.php similarity index 99% rename from lib/experimental/class-wp-icons-registry.php rename to lib/compat/wordpress-7.0/class-wp-icons-registry.php index 3d1bd279a152af..5d4a6e24acce46 100644 --- a/lib/experimental/class-wp-icons-registry.php +++ b/lib/compat/wordpress-7.0/class-wp-icons-registry.php @@ -23,7 +23,7 @@ class WP_Icons_Registry { * WP_Icons_Registry is a singleton class, so keep this private. */ private function __construct() { - $icons_directory = __DIR__ . '/../../packages/icons/src/'; + $icons_directory = __DIR__ . '/../../../packages/icons/src/'; $icons_directory = trailingslashit( $icons_directory ); $manifest_path = $icons_directory . 'manifest.php'; diff --git a/lib/experimental/class-wp-rest-icons-controller.php b/lib/compat/wordpress-7.0/class-wp-rest-icons-controller.php similarity index 100% rename from lib/experimental/class-wp-rest-icons-controller.php rename to lib/compat/wordpress-7.0/class-wp-rest-icons-controller.php diff --git a/lib/experimental/editor-settings.php b/lib/experimental/editor-settings.php index 6be9aab1925a98..9c90acc005c81d 100644 --- a/lib/experimental/editor-settings.php +++ b/lib/experimental/editor-settings.php @@ -69,11 +69,6 @@ function gutenberg_enable_block_experiments() { if ( $gutenberg_experiments && array_key_exists( 'gutenberg-block-experiments', $gutenberg_experiments ) ) { wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableBlockExperiments = true', 'before' ); } - - // Adding explicit support for the Icon block if the SVG icon registry is active. - if ( $gutenberg_experiments && array_key_exists( 'gutenberg-svg-icon-registry', $gutenberg_experiments ) ) { - wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableIconBlock = true', 'before' ); - } } add_action( 'admin_init', 'gutenberg_enable_block_experiments' ); diff --git a/lib/experiments-page.php b/lib/experiments-page.php index 1fee6ded0e5389..d23b38c8505142 100644 --- a/lib/experiments-page.php +++ b/lib/experiments-page.php @@ -221,18 +221,6 @@ function gutenberg_initialize_experiments_settings() { ) ); - add_settings_field( - 'gutenberg-svg-icon-registry', - __( 'SVG Icon Registration API', 'gutenberg' ), - 'gutenberg_display_experiment_field', - 'gutenberg-experiments', - 'gutenberg_experiments_section', - array( - 'label' => __( 'Enables a REST API endpoint for accessing SVG icons as well as the associated Icon block.', 'gutenberg' ), - 'id' => 'gutenberg-svg-icon-registry', - ) - ); - register_setting( 'gutenberg-experiments', 'gutenberg-experiments' diff --git a/lib/load.php b/lib/load.php index 0112aa9a9626d5..36da6f88e32f81 100644 --- a/lib/load.php +++ b/lib/load.php @@ -69,6 +69,8 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-block-patterns-controller-7-0.php'; require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-templates-controller-7-0.php'; require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-static-templates-controller.php'; + require __DIR__ . '/compat/wordpress-7.0/class-wp-icons-registry.php'; + require __DIR__ . '/compat/wordpress-7.0/class-wp-rest-icons-controller.php'; require __DIR__ . '/compat/wordpress-7.0/collaboration.php'; require __DIR__ . '/compat/wordpress-7.0/template-activate.php'; require __DIR__ . '/compat/wordpress-7.0/rest-api.php'; @@ -199,8 +201,3 @@ function gutenberg_is_experiment_enabled( $name ) { // Block patterns for navigation overlays. require __DIR__ . '/overlay-patterns.php'; - -if ( gutenberg_is_experiment_enabled( 'gutenberg-svg-icon-registry' ) ) { - require __DIR__ . '/experimental/class-wp-icons-registry.php'; - require __DIR__ . '/experimental/class-wp-rest-icons-controller.php'; -} diff --git a/lib/rest-api.php b/lib/rest-api.php index c4feaa763e79d3..4209b950c7cb40 100644 --- a/lib/rest-api.php +++ b/lib/rest-api.php @@ -40,10 +40,8 @@ function gutenberg_register_edit_site_export_controller_endpoints() { /** * Registers the Icons Registry REST API routes. */ -if ( gutenberg_is_experiment_enabled( 'gutenberg-svg-icon-registry' ) ) { - function gutenberg_register_icon_controller_endpoints() { - $icons_registry = new WP_REST_Icons_Controller(); - $icons_registry->register_routes(); - } - add_action( 'rest_api_init', 'gutenberg_register_icon_controller_endpoints' ); +function gutenberg_register_icon_controller_endpoints() { + $icons_registry = new WP_REST_Icons_Controller(); + $icons_registry->register_routes(); } +add_action( 'rest_api_init', 'gutenberg_register_icon_controller_endpoints' ); diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index 836a033bbfd8db..0dcd1b6a0b0f10 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -266,6 +266,7 @@ const getAllBlocks = () => { postCommentsForm, tableOfContents, homeLink, + icon, logInOut, navigationOverlayClose, termCount, @@ -295,10 +296,6 @@ const getAllBlocks = () => { blocks.push( playlistTrack ); } - if ( window?.__experimentalEnableIconBlock ) { - blocks.push( icon ); - } - // When in a WordPress context, conditionally // add the classic block and TinyMCE editor // under any of the following conditions: diff --git a/phpunit/bootstrap.php b/phpunit/bootstrap.php index 9e71495fbbed9d..bdde8917ac192a 100644 --- a/phpunit/bootstrap.php +++ b/phpunit/bootstrap.php @@ -91,7 +91,6 @@ function fail_if_died( $message ) { 'gutenberg-form-blocks' => 1, 'gutenberg-block-experiments' => 1, 'gutenberg-media-processing' => 1, - 'gutenberg-svg-icon-registry' => 1, ), ); diff --git a/test/integration/full-content/full-content.test.js b/test/integration/full-content/full-content.test.js index 7177b7048743e0..3df3bd3833a1c5 100644 --- a/test/integration/full-content/full-content.test.js +++ b/test/integration/full-content/full-content.test.js @@ -66,9 +66,6 @@ describe( 'full post content fixture', () => { // Form-related blocks will not be registered unless they are opted // in on the experimental settings page. window.__experimentalEnableFormBlocks = true; - // Icon block will not be registered unless are opted into on the - // experimental settings page. - window.__experimentalEnableIconBlock = true; registerCoreBlocks(); if ( globalThis.IS_GUTENBERG_PLUGIN ) {