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

Provide Block Pattern for Widget + Title to streamline creation of previous Widget screen markup #33874

Closed
getdave opened this issue Aug 4, 2021 · 2 comments
Assignees
Labels
[Feature] Widgets Customizer Ability to add and edit blocks in Customize → Widgets. [Feature] Widgets Screen The block-based screen that replaced widgets.php. [Package] Edit Widgets /packages/edit-widgets [Status] In Progress Tracking issues with work in progress

Comments

@getdave
Copy link
Contributor

getdave commented Aug 4, 2021

What problem does this address?

As discussed at length in #32723 the previous (non-block based) Widgets screen provided a discrete HTML structure for a "Widget".

This was:

  • Wrapping container element (Widget wrapper)
  • Heading element (Widget title)
  • Widget (the actual body of the Widget itself).

The new block based editor doesn't do this. Instead each block that is added is treated as a standalone "Widget". This makes is very difficult to replicate the structure of the previous Widgets screen in the new screen. This is often necessary for reasons of backwards compatibility.

What is your proposed solution?

I've been exploring providing a Block Pattern called "Widget and title". When added this creates:

  • core/group block with a class of c-widget.
  • [Child] core/heading block with a placeholder and a class of c-widget__title.

All the user then need do is insert their chosen widget block (e.g. Archives) as a sibling of the Heading block (child of the Group) and you have a good replica of the previous structure.

This avoids the hassle of creating it manually. Here's a demo of a prototype I created by hardcoding some block patterns in the edit-widgets package:

Screen.Capture.on.2021-08-04.at.13-39-42.mp4

In the future we could also explore whether it's possible to automatically transform a standalone Widget block into this Pattern.

@getdave getdave added [Feature] Widgets Screen The block-based screen that replaced widgets.php. [Package] Edit Widgets /packages/edit-widgets [Feature] Widgets Customizer Ability to add and edit blocks in Customize → Widgets. labels Aug 4, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Aug 4, 2021
@justintadlock
Copy link
Contributor

Related: #26170

@draganescu
Copy link
Contributor

This has been solved by the introduction of the Widget Group block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Widgets Customizer Ability to add and edit blocks in Customize → Widgets. [Feature] Widgets Screen The block-based screen that replaced widgets.php. [Package] Edit Widgets /packages/edit-widgets [Status] In Progress Tracking issues with work in progress
Projects
None yet
3 participants