PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 4.0.7
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v4.0.7
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / includes / widgets / gutenberg / lib / block-editor-settings.php
widget-options / includes / widgets / gutenberg / lib Last commit date
block-supports 1 year ago compat 1 year ago experimental 1 year ago README.md 1 year ago block-editor-settings.php 1 year ago blocks.php 1 year ago class-wp-duotone-gutenberg.php 1 year ago class-wp-theme-json-data-gutenberg.php 1 year ago class-wp-theme-json-gutenberg.php 1 year ago class-wp-theme-json-resolver-gutenberg.php 1 year ago client-assets.php 1 year ago demo.php 1 year ago experiments-page.php 1 year ago global-styles-and-settings.php 1 year ago init.php 1 year ago load.php 1 year ago script-loader.php 1 year ago theme-i18n.json 1 year ago theme.json 1 year ago upgrade.php 1 year ago
block-editor-settings.php
83 lines
1 <?php
2 /**
3 * Adds settings to the block editor.
4 *
5 * @package gutenberg
6 */
7
8 /**
9 * Adds styles and __experimentalFeatures to the block editor settings.
10 *
11 * Note: The settings that are WP version specific should be handled inside the `compat` directory.
12 *
13 * @param array $settings Existing block editor settings.
14 *
15 * @return array New block editor settings.
16 */
17 function gutenberg_get_block_editor_settings( $settings ) {
18 // Recreate global styles.
19 $global_styles = array();
20 $presets = array(
21 array(
22 'css' => 'variables',
23 '__unstableType' => 'presets',
24 'isGlobalStyles' => true,
25 ),
26 array(
27 'css' => 'presets',
28 '__unstableType' => 'presets',
29 'isGlobalStyles' => true,
30 ),
31 );
32 foreach ( $presets as $preset_style ) {
33 $actual_css = gutenberg_get_global_stylesheet( array( $preset_style['css'] ) );
34 if ( '' !== $actual_css ) {
35 $preset_style['css'] = $actual_css;
36 $global_styles[] = $preset_style;
37 }
38 }
39
40 if ( wp_theme_has_theme_json() ) {
41 $block_classes = array(
42 'css' => 'styles',
43 '__unstableType' => 'theme',
44 'isGlobalStyles' => true,
45 );
46 $actual_css = gutenberg_get_global_stylesheet( array( $block_classes['css'] ) );
47 if ( '' !== $actual_css ) {
48 $block_classes['css'] = $actual_css;
49 $global_styles[] = $block_classes;
50 }
51
52 /*
53 * Add the custom CSS as a separate stylesheet so any invalid CSS
54 * entered by users does not break other global styles.
55 */
56 $global_styles[] = array(
57 'css' => gutenberg_get_global_styles_custom_css(),
58 '__unstableType' => 'user',
59 'isGlobalStyles' => true,
60 );
61 } else {
62 // If there is no `theme.json` file, ensure base layout styles are still available.
63 $block_classes = array(
64 'css' => 'base-layout-styles',
65 '__unstableType' => 'base-layout',
66 'isGlobalStyles' => true,
67 );
68 $actual_css = gutenberg_get_global_stylesheet( array( $block_classes['css'] ) );
69 if ( '' !== $actual_css ) {
70 $block_classes['css'] = $actual_css;
71 $global_styles[] = $block_classes;
72 }
73 }
74
75 $settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() );
76
77 // Copied from get_block_editor_settings() at wordpress-develop/block-editor.php.
78 $settings['__experimentalFeatures'] = gutenberg_get_global_settings();
79
80 return $settings;
81 }
82 add_filter( 'block_editor_settings_all', 'gutenberg_get_block_editor_settings', PHP_INT_MAX );
83