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

Fix invalid HTML structure on the widgets screen #24866

Merged
merged 6 commits into from
Aug 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use a named function instead of anonymous one
  • Loading branch information
adamziel committed Aug 27, 2020
commit 1bcbda66fa4e39aead844783a05df069f9c0229e
22 changes: 12 additions & 10 deletions gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,20 @@ function gutenberg_register_widgets() {
if ( 'widgets.php' === $pagenow ) {
add_filter(
'dynamic_sidebar_params',
function ( $arg ) {
if ( 'Block' === $arg[0]['widget_name'] ) {
$arg[0]['before_form'] = '';
$arg[0]['before_widget_content'] = '<div class="widget-content">';
$arg[0]['after_widget_content'] = '</div><form class="block-widget-form">';
$arg[0]['after_form'] = '</form>';
}

return $arg;
}
'gutenberg_override_sidebar_params_for_block_widget'
);
}
}

function gutenberg_override_sidebar_params_for_block_widget( $arg ) {
if ( 'Block' === $arg[0]['widget_name'] ) {
$arg[0]['before_form'] = '';
$arg[0]['before_widget_content'] = '<div class="widget-content">';
$arg[0]['after_widget_content'] = '</div><form class="block-widget-form">';
$arg[0]['after_form'] = '</form>';
}

return $arg;
}

add_action( 'widgets_init', 'gutenberg_register_widgets' );