diff --git a/src/wp-includes/behaviors.php b/src/wp-includes/behaviors.php new file mode 100644 index 0000000000000..623fff7b8d84c --- /dev/null +++ b/src/wp-includes/behaviors.php @@ -0,0 +1,23 @@ +get_data(); + if ( array_key_exists( 'behaviors', $theme_data ) ) { + $settings['behaviors'] = $theme_data['behaviors']; + } + return $settings; +} diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index f21a32fa41cc1..99ac8e11b1d51 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -321,6 +321,7 @@ class WP_Theme_JSON { 'templateParts', 'title', 'version', + 'behaviors', ); /** @@ -398,6 +399,7 @@ class WP_Theme_JSON { 'textDecoration' => null, 'textTransform' => null, ), + 'behaviors' => null, ); /** diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 063199269c48c..3e36041bda153 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -720,4 +720,7 @@ // User preferences. add_action( 'init', 'wp_register_persisted_preferences_meta' ); +// Behaviors +add_filter( 'block_editor_settings_all', 'wp_add_behaviors' ); + unset( $filter, $action ); diff --git a/src/wp-includes/theme.json b/src/wp-includes/theme.json index af447990608a3..6a76b89e8a5b8 100644 --- a/src/wp-includes/theme.json +++ b/src/wp-includes/theme.json @@ -1,5 +1,12 @@ { "version": 2, + "behaviors": { + "blocks": { + "core/image": { + "lightbox": false + } + } + }, "settings": { "appearanceTools": false, "useRootPaddingAwareAlignments": false, @@ -414,6 +421,11 @@ "style": true, "width": true } + }, + "core/image": { + "behaviors": { + "lightbox": true + } } } }, diff --git a/src/wp-settings.php b/src/wp-settings.php index 6a7e8098723fe..115a8b96c6070 100644 --- a/src/wp-settings.php +++ b/src/wp-settings.php @@ -344,6 +344,7 @@ require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-rule.php'; require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-rules-store.php'; require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-processor.php'; +require ABSPATH . WPINC . '/behaviors.php'; $GLOBALS['wp_embed'] = new WP_Embed();