Skip to content
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

Closed

Conversation

michalczaplinski
Copy link
Contributor

Backport the PR that introduced the Behaviors UI in the block editor:

Trac ticket: https://core.trac.wordpress.org/ticket/58431


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@dream-encode
Copy link
Contributor

@michalczaplinski Aside from the WPCS issues, the unit tests are failing because the behaviors.php file isn't included. This should probably be added in wp-settings.php, but I am not 100% sure where this would best fit.

@michalczaplinski
Copy link
Contributor Author

michalczaplinski commented May 30, 2023

Ok, fixed it.

should probably be added in wp-settings.php, but I am not 100% sure where this would best fit.

I'm also not 100% sure if this is the best place, but I've put it there like you suggested.

Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @michalczaplinski, Left some nitpick feedback.

*
* @package WordPress
* @since 6.3.0
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*

Comment on lines +13 to +14
* @since 6.3.0
* @param array $editor_settings The array of editor settings.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 6.3.0
* @param array $editor_settings The array of editor settings.
* @since 6.3.0
*
* @param array $editor_settings The 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 ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead if array_key_exists use isset

@@ -720,4 +720,7 @@
// User preferences.
add_action( 'init', 'wp_register_persisted_preferences_meta' );

// Behaviors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Behaviors
// Behaviors.

@cbravobernal
Copy link
Contributor

We can close this backport as it will be punted for 6.4 - I guess for that time there will be different code.

@ramonjd
Copy link
Member

ramonjd commented Jun 16, 2023

It looks like this will be postponed until 6.4.

See @c4rl0sbr4v0's comment: WordPress/gutenberg#51077 (comment)

@michalczaplinski
Copy link
Contributor Author

Behaviors have been removed from the Gutenberg plugin in WordPress/gutenberg#53851.

An updated implementation of the Image Lightbox has been created in WordPress/gutenberg#54509 where the Lightbox is not a Behavior but a feature of the Image block.

The above PRs have a corresponding backport in #5248

In the light of all that, we can now close this PR.

@michalczaplinski michalczaplinski deleted the behaviors-ui-backport branch September 19, 2023 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants