← All changes
|
lib/experimental/block-editor-settings-mobile.php
+17
-8
23.5.3
→
14.5.2
View file →
| @@ -15,16 +15,25 @@ | ||
| 15 | 15 | * |
| 16 | 16 | * @return array New block editor settings. |
| 17 | 17 | */ |
| 18 | 18 | function gutenberg_get_block_editor_settings_mobile( $settings ) { |
| 19 | - if ( wp_theme_has_theme_json() ) { | |
| 20 | - $settings['__experimentalStyles'] = gutenberg_get_global_styles(); | |
| 19 | + if ( | |
| 20 | + defined( 'REST_REQUEST' ) && | |
| 21 | + REST_REQUEST && | |
| 22 | + isset( $_GET['context'] ) && | |
| 23 | + 'mobile' === $_GET['context'] | |
| 24 | + ) { | |
| 25 | + if ( wp_theme_has_theme_json() ) { | |
| 26 | + $settings['__experimentalStyles'] = gutenberg_get_global_styles(); | |
| 27 | + } | |
| 28 | + | |
| 29 | + // To tell mobile that the site uses quote v2 (inner blocks). | |
| 30 | + // See https://github.com/WordPress/gutenberg/pull/25892. | |
| 31 | + $settings['__experimentalEnableQuoteBlockV2'] = true; | |
| 32 | + // To tell mobile that the site uses list v2 (inner blocks). | |
| 33 | + $settings['__experimentalEnableListBlockV2'] = true; | |
| 21 | 34 | } |
| 22 | 35 | |
| 23 | - // To tell mobile that the site uses quote v2 (inner blocks). | |
| 24 | - // See https://github.com/WordPress/gutenberg/pull/25892. | |
| 25 | - $settings['__experimentalEnableQuoteBlockV2'] = true; | |
| 26 | - // To tell mobile that the site uses list v2 (inner blocks). | |
| 27 | - $settings['__experimentalEnableListBlockV2'] = true; | |
| 28 | - | |
| 29 | 36 | return $settings; |
| 30 | 37 | } |
| 38 | + | |
| 39 | +add_filter( 'block_editor_settings_all', 'gutenberg_get_block_editor_settings_mobile', PHP_INT_MAX ); | |