diff --git a/lib/experimental/block-editor-settings-mobile.php b/lib/experimental/block-editor-settings-mobile.php index d0a0e7add5319..4319f8766352c 100644 --- a/lib/experimental/block-editor-settings-mobile.php +++ b/lib/experimental/block-editor-settings-mobile.php @@ -29,6 +29,8 @@ function gutenberg_get_block_editor_settings_mobile( $settings ) { // To tell mobile that the site uses quote v2 (inner blocks). // See https://github.com/WordPress/gutenberg/pull/25892. $settings['__experimentalEnableQuoteBlockV2'] = true; + // To be set to true when the web makes quote v2 (inner blocks) the default. + $settings['__experimentalEnableListBlockV2'] = gutenberg_is_list_v2_enabled(); } return $settings; diff --git a/lib/experimental/blocks.php b/lib/experimental/blocks.php index c92358621c5de..80691e5d917ab 100644 --- a/lib/experimental/blocks.php +++ b/lib/experimental/blocks.php @@ -5,11 +5,21 @@ * @package gutenberg */ +/** + * Returns whether list v2 is enabled by the user. + * + * @return boolean + */ +function gutenberg_is_list_v2_enabled() { + $gutenberg_experiments = get_option( 'gutenberg-experiments' ); + return $gutenberg_experiments && array_key_exists( 'gutenberg-list-v2', $gutenberg_experiments ); +} + /** * Sets a global JS variable used to trigger the availability of the experimental blocks. */ function gutenberg_enable_experimental_blocks() { - if ( get_option( 'gutenberg-experiments' ) && array_key_exists( 'gutenberg-list-v2', get_option( 'gutenberg-experiments' ) ) ) { + if ( gutenberg_is_list_v2_enabled() ) { wp_add_inline_script( 'wp-block-library', 'window.__experimentalEnableListBlockV2 = true', 'before' ); } } diff --git a/lib/experimental/class-wp-rest-block-editor-settings-controller.php b/lib/experimental/class-wp-rest-block-editor-settings-controller.php index d9b726f1158da..74b5eb4e9a875 100644 --- a/lib/experimental/class-wp-rest-block-editor-settings-controller.php +++ b/lib/experimental/class-wp-rest-block-editor-settings-controller.php @@ -162,6 +162,12 @@ public function get_item_schema() { 'context' => array( 'mobile' ), ), + '__experimentalEnableListBlockV2' => array( + 'description' => __( 'Whether the V2 of the list block that uses inner blocks should be enabled.', 'gutenberg' ), + 'type' => 'boolean', + 'context' => array( 'mobile' ), + ), + 'alignWide' => array( 'description' => __( 'Enable/Disable Wide/Full Alignments.', 'gutenberg' ), 'type' => 'boolean',