Skip to content

Backport: Add the Behaviors UI#4526

Closed
michalczaplinski wants to merge 4 commits intoWordPress:trunkfrom
michalczaplinski:behaviors-ui-backport
Closed

Backport: Add the Behaviors UI#4526
michalczaplinski wants to merge 4 commits intoWordPress:trunkfrom
michalczaplinski:behaviors-ui-backport

Conversation

@michalczaplinski
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

// User preferences.
add_action( 'init', 'wp_register_persisted_preferences_meta' );

// Behaviors
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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