-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport: Add the Behaviors UI #4526
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||||||||
<?php | ||||||||||||
/** | ||||||||||||
* Block Behaviors. | ||||||||||||
* | ||||||||||||
* @package WordPress | ||||||||||||
* @since 6.3.0 | ||||||||||||
* | ||||||||||||
*/ | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Updates the block editor settings with the theme's behaviors. | ||||||||||||
* | ||||||||||||
* @since 6.3.0 | ||||||||||||
* @param array $editor_settings The array of editor settings. | ||||||||||||
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* @return array A filtered array of editor settings. | ||||||||||||
*/ | ||||||||||||
function wp_add_behaviors( $settings ) { | ||||||||||||
$theme_data = WP_Theme_JSON_Resolver::get_merged_data()->get_data(); | ||||||||||||
if ( array_key_exists( 'behaviors', $theme_data ) ) { | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead if |
||||||||||||
$settings['behaviors'] = $theme_data['behaviors']; | ||||||||||||
} | ||||||||||||
return $settings; | ||||||||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -720,4 +720,7 @@ | |||||
// User preferences. | ||||||
add_action( 'init', 'wp_register_persisted_preferences_meta' ); | ||||||
|
||||||
// Behaviors | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
add_filter( 'block_editor_settings_all', 'wp_add_behaviors' ); | ||||||
|
||||||
unset( $filter, $action ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.