-
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
Add block-based widget editor #603
Conversation
5951f75
to
33afc78
Compare
echo do_blocks( $instance['content'] ); | ||
$textarea_id = $this->get_field_id( 'content' ); | ||
?> | ||
<br/> |
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.
@adamziel: Do you know if the <br />
is necessary? It doesn't seem to do much.
$textarea_id = $this->get_field_id( 'content' ); | ||
?> | ||
<br/> | ||
<textarea id="<?php echo $textarea_id; ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" |
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.
@adamziel: Do you know why this is a hidden textarea
and not an <input type="hidden">
?
*/ | ||
public function form( $instance ) { | ||
$instance = wp_parse_args( (array) $instance, $this->default_instance ); | ||
echo do_blocks( $instance['content'] ); |
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.
I didn't port over the hack that Gutenberg does to ensure that <form>
elements don't get nested within other <form>
elements here because I'd like to find a better way of fixing that.
@@ -262,6 +262,8 @@ | |||
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-directory-controller.php'; | |||
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-application-passwords-controller.php'; | |||
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-site-health-controller.php'; | |||
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-sidebars-controller.php'; | |||
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-widget-utils-controller.php'; |
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.
These files are included in this PR for testing purposes. They'll land separately in https://core.trac.wordpress.org/ticket/51460.
OK, I think this is ready to be reviewed and committed. The REST API endpoints are included so that it's easier to test, but these should be added separately via https://core.trac.wordpress.org/ticket/51460 before this PR is committed. |
9777ef2
to
18dba4e
Compare
@noisysocks Just noticed we'll also have to make sure |
I'm a little unclear on whether |
@noisysocks it means this page is a full-screen block editor - potentially specific to post/page. It does not mean this page has any block editor somewhere on it. the entire reason for this change: https://core.trac.wordpress.org/ticket/51330 |
Got it. We'll need to take a different approach in WordPress/gutenberg#26263, then. cc. @talldan |
@noisysocks @adamziel What does 'full-screen' mean in this context? The class seems to have been added in WordPress 5.0 quite a long time before the post editor was full screen by default (https://core.trac.wordpress.org/changeset/44133, https://core.trac.wordpress.org/ticket/45037), so it seems like it should be perfectly fine to have a non-fullscreen block editor but still have I just want to question the assumptions here since I don't see why the widgets screen would have I think what we can all agree on is that it definitely seems like this one boolean has way too much responsibility, and it should probably be made more granular along the lines of https://core.trac.wordpress.org/ticket/51330. Full screen mosde should also not be implicit to However, as part of that, I think we should try to make |
The
@talldan you hit the nail on the head. I'm all for marking the widgets editor as a |
Trac ticket: https://core.trac.wordpress.org/ticket/51506
Supersedes #588.
This moves the the block-based widget editor over from Gutenberg into Core.
Broadly speaking, there's three parts to this:
@wordpress/edit-widgets
is added as a dependency. This is what contains the editor UI.wp-admin/widgets.php
has been modified to branch between the old form-based editorwp-admin/widgets-form.php
and the new block-based editorwp-admin/widgets-block-editor.php
depending onget_theme_support( 'widgets-block-editor' )
anduse_widgets_block_editor
.Supporting infrastructure such as
WP_Widget_Block
andwidgets.php?widget-preview={}
has been copied over from Gutenberg.This PR contains
WP_REST_Sidebars_Controller
andWP_REST_Widget_Utils_Controller
so that it's easier to test, but these parts should be committed separately.How to test
npm run env:start
npm run env:install
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.