widget-options
/
includes
/
widgets
/
gutenberg
/
lib
/
experimental
/
block-editor-settings-mobile.php
fonts-api
2 years ago
interactivity-api
2 years ago
block-editor-settings-mobile.php
2 years ago
block-editor-settings.php
2 years ago
blocks.php
2 years ago
class-gutenberg-rest-global-styles-revisions-controller.php
2 years ago
class-wp-classic-to-block-menu-converter.php
2 years ago
class-wp-navigation-fallback-gutenberg.php
2 years ago
class-wp-rest-block-editor-settings-controller.php
2 years ago
class-wp-rest-customizer-nonces.php
2 years ago
class-wp-rest-navigation-fallback-controller.php
2 years ago
editor-settings.php
2 years ago
kses.php
2 years ago
l10n.php
2 years ago
navigation-fallback.php
2 years ago
navigation-theme-opt-in.php
2 years ago
rest-api.php
2 years ago
block-editor-settings-mobile.php
40 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Adds settings to the mobile block editor. |
| 4 | * |
| 5 | * @package gutenberg |
| 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * Adds settings to the mobile block editor. |
| 10 | * |
| 11 | * This is used by the settings REST endpoint and it should land in core |
| 12 | * as soon as lib/class-wp-rest-block-editor-settings-controller.php does. |
| 13 | * |
| 14 | * @param array $settings Existing block editor settings. |
| 15 | * |
| 16 | * @return array New block editor settings. |
| 17 | */ |
| 18 | function gutenberg_get_block_editor_settings_mobile( $settings ) { |
| 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; |
| 34 | } |
| 35 | |
| 36 | return $settings; |
| 37 | } |
| 38 | |
| 39 | add_filter( 'block_editor_settings_all', 'gutenberg_get_block_editor_settings_mobile', PHP_INT_MAX ); |
| 40 |