lib/experimental
connectors
3 months ago
content-types
3 months ago
dashboard-widgets
3 months ago
experiments
3 months ago
font-face
1 year ago
guidelines
3 months ago
interactivity-api
1 year ago
media-editor
3 months ago
pages
6 months ago
block-editor-settings-mobile.php
888 B
2 years ago
blocks.php
4.4 KB
7 months ago
class-gutenberg-hierarchical-sort.php
4.7 KB
6 months ago
class-wp-rest-block-editor-settings-controller.php
24.2 KB
7 months ago
editor-settings.php
3.3 KB
3 months ago
extensible-site-editor.php
975 B
7 months ago
kses-allowed-html.php
965 B
1 year ago
kses.php
6.2 KB
5 months ago
navigation-theme-opt-in.php
13.3 KB
6 months ago
rest-api-overrides.php
1.6 KB
9 months ago
rest-api.php
3.2 KB
7 months ago
script-modules.php
7.9 KB
6 months ago
workflow-palette.php
355 B
9 months ago
editor-settings.php in Gutenberg 23.2.0, at lib/experimental/editor-settings.php
| 1 | <?php |
| 2 | /** |
| 3 | * Utilities to manage editor settings. |
| 4 | * |
| 5 | * @package gutenberg |
| 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * Sets a global JS variable used to trigger the availability of each Gutenberg Experiment. |
| 10 | */ |
| 11 | function gutenberg_enable_experiments() { |
| 12 | if ( gutenberg_is_experiment_enabled( 'gutenberg-color-randomizer' ) ) { |
| 13 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableColorRandomizer = true', 'before' ); |
| 14 | } |
| 15 | if ( gutenberg_is_experiment_enabled( 'gutenberg-grid-interactivity' ) ) { |
| 16 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableGridInteractivity = true', 'before' ); |
| 17 | } |
| 18 | if ( gutenberg_is_experiment_enabled( 'gutenberg-dataviews-media-modal' ) ) { |
| 19 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalDataViewsMediaModal = true', 'before' ); |
| 20 | } |
| 21 | if ( gutenberg_is_experiment_enabled( 'gutenberg-content-only-inspector-fields' ) ) { |
| 22 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalContentOnlyInspectorFields = true', 'before' ); |
| 23 | } |
| 24 | if ( gutenberg_is_experiment_enabled( 'active_templates' ) ) { |
| 25 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalTemplateActivate = true', 'before' ); |
| 26 | } |
| 27 | if ( gutenberg_is_experiment_enabled( 'gutenberg-extensible-site-editor' ) ) { |
| 28 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalExtensibleSiteEditor = true', 'before' ); |
| 29 | } |
| 30 | if ( gutenberg_is_experiment_enabled( 'gutenberg-dataform-inspector' ) ) { |
| 31 | wp_add_inline_script( 'wp-editor', 'window.__experimentalDataFormInspector = true', 'before' ); |
| 32 | } |
| 33 | if ( gutenberg_is_experiment_enabled( 'gutenberg-media-editor' ) ) { |
| 34 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalMediaEditor = true', 'before' ); |
| 35 | } |
| 36 | if ( gutenberg_is_experiment_enabled( 'gutenberg-media-editor-modal' ) ) { |
| 37 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalMediaEditorModal = true', 'before' ); |
| 38 | } |
| 39 | if ( gutenberg_is_experiment_enabled( 'gutenberg-dashboard-widgets' ) ) { |
| 40 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalDashboardWidgets = true', 'before' ); |
| 41 | } |
| 42 | if ( gutenberg_is_experiment_enabled( 'gutenberg-classic-block-deprecation' ) ) { |
| 43 | wp_add_inline_script( 'wp-block-library', 'window.__experimentalClassicBlockDeprecation = true', 'before' ); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | add_action( 'admin_init', 'gutenberg_enable_experiments' ); |
| 48 | add_action( 'site-editor-v2_init', 'gutenberg_enable_experiments' ); |
| 49 | |
| 50 | /** |
| 51 | * Sets a global JS variable used to trigger the availability of form & input blocks. |
| 52 | * |
| 53 | * @deprecated 19.0.0 Use gutenberg_enable_block_experiments(). |
| 54 | */ |
| 55 | function gutenberg_enable_form_input_blocks() { |
| 56 | _deprecated_function( __FUNCTION__, 'Gutenberg 19.0.0', 'gutenberg_enable_block_experiments' ); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Sets global JS variables used to enable various block experiments. |
| 61 | */ |
| 62 | function gutenberg_enable_block_experiments() { |
| 63 | // Experimental form blocks. |
| 64 | if ( gutenberg_is_experiment_enabled( 'gutenberg-form-blocks' ) ) { |
| 65 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableFormBlocks = true', 'before' ); |
| 66 | } |
| 67 | |
| 68 | // General experimental blocks that are not in the default block library. |
| 69 | if ( gutenberg_is_experiment_enabled( 'gutenberg-block-experiments' ) ) { |
| 70 | wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableBlockExperiments = true', 'before' ); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | add_action( 'admin_init', 'gutenberg_enable_block_experiments' ); |
| 75 |