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

Try making server aware of block variants #1015

Closed
wants to merge 14 commits into from

Conversation

gwwar
Copy link

@gwwar gwwar commented Feb 17, 2021

https://core.trac.wordpress.org/ticket/52688

Experiment, required for WordPress/gutenberg#29095

This PR exposes variations in the block type definition and adds two new labels item_link and item_link_description for post types and taxonomies.

Changes here will allow us to populate link navigation variations via register_block_type_from_metadata without needing to update the post type and taxonomy REST APIs to allow filtering by show_in_nav_menus.

Testing Instructions

  • Checkout and run this branch locally with an environment of your choice. (Don't forget to npm run build)
  • Test the GET REST endpoint /wp/v2/block-types. Notice how there is a new variations field returned.
  • Make sure local tests pass by running npm run test:php -- --filter REST_Block_Type_Controller_Test

Screen Shot 2021-02-24 at 8 31 02 PM

If you like, also follow test instructions in WordPress/gutenberg#29095.

navigationlink.mp4

Default label behavior

Screen Shot 2021-03-01 at 12 34 45 PM

src/wp-includes/blocks.php Outdated Show resolved Hide resolved
@gziolo
Copy link
Member

gziolo commented Feb 23, 2021

This is looking good. I think we should plan to land it in WordPress core short after trunk is open for new features.

@gwwar gwwar marked this pull request as ready for review February 25, 2021 04:33
src/wp-includes/post.php Outdated Show resolved Hide resolved
@gziolo
Copy link
Member

gziolo commented Mar 1, 2021

We need a ticket in Trac to proceed further. As far as I can tell, there are only two remaining changes required:

  • variations shouldn't be integrated with register_block_type_from_metadata for start
  • CPT label need the default values

@gwwar
Copy link
Author

gwwar commented Mar 1, 2021

Thanks @gziolo @TimothyBJacobs for all the reviews! I think I responded to all feedback, but let me know if I missed any items.

I also created a trac ticket: https://core.trac.wordpress.org/ticket/52688#ticket

@gziolo
Copy link
Member

gziolo commented Mar 8, 2021

I'm adding the Trac ticket to my list of items to take care of later this week. I want to wait until WordPress 5.7 is out before committing. Nice work @gwwar

@gwwar
Copy link
Author

gwwar commented Mar 12, 2021

This landed in 380d044 💖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants