-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Expand file tree
/
Copy pathblock-editor-settings-mobile.php
More file actions
39 lines (35 loc) · 1.1 KB
/
block-editor-settings-mobile.php
File metadata and controls
39 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Adds settings to the mobile block editor.
*
* @package gutenberg
*/
/**
* Adds settings to the mobile block editor.
*
* This is used by the settings REST endpoint and it should land in core
* as soon as lib/class-wp-rest-block-editor-settings-controller.php does.
*
* @param array $settings Existing block editor settings.
*
* @return array New block editor settings.
*/
function gutenberg_get_block_editor_settings_mobile( $settings ) {
if (
defined( 'REST_REQUEST' ) &&
REST_REQUEST &&
isset( $_GET['context'] ) &&
'mobile' === $_GET['context']
) {
if ( wp_theme_has_theme_json() ) {
$settings['__experimentalStyles'] = gutenberg_get_global_styles();
}
// To tell mobile that the site uses quote v2 (inner blocks).
// See https://github.com/WordPress/gutenberg/pull/25892.
$settings['__experimentalEnableQuoteBlockV2'] = true;
// To tell mobile that the site uses list v2 (inner blocks).
$settings['__experimentalEnableListBlockV2'] = true;
}
return $settings;
}
add_filter( 'block_editor_settings_all', 'gutenberg_get_block_editor_settings_mobile', PHP_INT_MAX );