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

Create Block: Update the list of default categories to pick from after WordPress 5.5 is out #22848

Closed
gziolo opened this issue Jun 3, 2020 · 2 comments · Fixed by #26448
Closed
Assignees
Labels
Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Tool] Create Block /packages/create-block [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@gziolo
Copy link
Member

gziolo commented Jun 3, 2020

Description

It's possible now to register blocks without providing the category. It became optional in #22280.

In addition to that, there is now a refined list of categories as of #19279:

  • Text
  • Media
  • Design
  • Widgets (Unchanged)
  • Embeds (Unchanged)
  • Reusable (Unchanged)

@wordpress/create-block uses now those new categories and in general, with those two aforementioned changes, it should work just fine for blocks targeting WordPress 5.5 (scheduled for August) and with the next version (8.3) of Gutenberg plugin.

There is this question whether including an entry in the CHANGELOG file referencing this draft of Dev Note would be enough:
#19279 (comment)

An alternative would be to include PHP code that maps old and new names as explained in the same Dev Note.

Proposed Changes

When WordPress 5.5 is out we should update the list of categories and set the minimum required version of WordPress to 5.5.5. Related lines in the codebase:



choices: [ 'common', 'embed', 'formatting', 'layout', 'widgets' ],

@gziolo gziolo added [Tool] Create Block /packages/create-block [Type] Developer Documentation Documentation for developers Backwards Compatibility Issues or PRs that impact backwards compatability labels Jun 3, 2020
@aduth
Copy link
Member

aduth commented Jun 3, 2020

It could technically be possible as well to revert back to the old categories, which will work in WordPress 5.0 - 5.4, and continue to work in WordPress 5.5, albeit mapped automatically to their new approximate equivalents. It's really only a temporary solution though, and leaves open the question when to switch over to the new values. Plus, it's not ideal to continue shipping the scaffolding tool using now-defunct category values.

The solution at #19279 (comment) could be a nice middle-ground. I was a bit displeased to discover that get_block_categories requires a valid post argument. It would be good to test as a verification that the devnote sample is workable in all cases. It may also be worth testing to see if providing a value of null could suffice as well, though depending if a plugin filters the block_categories filter and expects the provided $post argument, it could yield some conflict if that were provided as null.

@gziolo
Copy link
Member Author

gziolo commented Jun 4, 2020

It could technically be possible as well to revert back to the old categories, which will work in WordPress 5.0 - 5.4, and continue to work in WordPress 5.5, albeit mapped automatically to their new approximate equivalents. It's really only a temporary solution though, and leaves open the question when to switch over to the new values. Plus, it's not ideal to continue shipping the scaffolding tool using now-defunct category values.

I have only realized that we need to use the JavaScript version of the proposal because the template used doesn't register category on the server. Regardless, I'm leaning towards leaving old category names until WordPress 5.5 is out. At the same time, I see the need for a new optional template that uses block.json that could use a new set of categories as well. This way we could promote the best experience for those who want to work with what the Gutenberg plugin offers but ensure that the majority build blocks that work by default with the actual version of WordPress without the plugin installed.

gziolo added a commit that referenced this issue Jun 6, 2020
Related issue: #22848
It ensures that blocks will continue to work with WordPress 5.4.x.
We should be able to use the new set of categories once WordPress 5.5 is out.
gziolo added a commit that referenced this issue Jun 7, 2020
* Create Block: Revert changes to the list of categories in the prompt
Related issue: #22848
It ensures that blocks will continue to work with WordPress 5.4.x.
We should be able to use the new set of categories once WordPress 5.5 is out.

* Create Block: Add inline comments explaining how CSS imports in JS work
@gziolo gziolo changed the title Create Block: Make sure blocks using new categories will work with WordPress 5.4.x Create Block: Update the list of default categories to pick from after WordPress 5.5 is out Jul 9, 2020
@gziolo gziolo added [Type] Task Issues or PRs that have been broken down into an individual action to take Needs Dev Ready for, and needs developer efforts and removed Backwards Compatibility Issues or PRs that impact backwards compatability [Type] Developer Documentation Documentation for developers labels Jul 9, 2020
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Tool] Create Block /packages/create-block [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants