-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: Use register_block_type_from_metadata to register blocks on the server #28883
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Size Change: +1.73 kB (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
af9d8bc
to
6e615d4
Compare
gziolo
commented
Feb 9, 2021
packages/create-block-tutorial-template/templates/readme.txt.mustache
Outdated
Show resolved
Hide resolved
6e615d4
to
8a85bc9
Compare
We miss the mapping layer during registration that would transform kyes from PHP to JS.
8a85bc9
to
9b01bfd
Compare
6 tasks
nylen
pushed a commit
to nylen/wordpress-develop-svn
that referenced
this pull request
Feb 12, 2021
… blocks for the block editor When working on changes to @wordpress/create-block tool (WordPress/gutenberg#28883) to use register_block_type_from_metadata with block.json file in the templates for scaffolded blocks I run into this issue where apiVersion wasn't exposed from the server. Fixes #52512. git-svn-id: https://develop.svn.wordpress.org/trunk@50297 602fd350-edb4-49c9-b593-d223f7449a82
pento
pushed a commit
to WordPress/wordpress-develop
that referenced
this pull request
Feb 12, 2021
… blocks for the block editor When working on changes to @wordpress/create-block tool (WordPress/gutenberg#28883) to use register_block_type_from_metadata with block.json file in the templates for scaffolded blocks I run into this issue where apiVersion wasn't exposed from the server. Fixes #52512. git-svn-id: https://develop.svn.wordpress.org/trunk@50297 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith
pushed a commit
to markjaquith/WordPress
that referenced
this pull request
Feb 12, 2021
… blocks for the block editor When working on changes to @wordpress/create-block tool (WordPress/gutenberg#28883) to use register_block_type_from_metadata with block.json file in the templates for scaffolded blocks I run into this issue where apiVersion wasn't exposed from the server. Fixes #52512. Built from https://develop.svn.wordpress.org/trunk@50297 git-svn-id: http://core.svn.wordpress.org/trunk@49942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
gMagicScott
pushed a commit
to gMagicScott/core.wordpress-mirror
that referenced
this pull request
Feb 12, 2021
… blocks for the block editor When working on changes to @wordpress/create-block tool (WordPress/gutenberg#28883) to use register_block_type_from_metadata with block.json file in the templates for scaffolded blocks I run into this issue where apiVersion wasn't exposed from the server. Fixes #52512. Built from https://develop.svn.wordpress.org/trunk@50297 git-svn-id: https://core.svn.wordpress.org/trunk@49942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
7 tasks
F-Wilke
pushed a commit
to FiliagoDev/WordPress
that referenced
this pull request
Jul 31, 2021
… blocks for the block editor When working on changes to @wordpress/create-block tool (WordPress/gutenberg#28883) to use register_block_type_from_metadata with block.json file in the templates for scaffolded blocks I run into this issue where apiVersion wasn't exposed from the server. Fixes #52512. Built from https://develop.svn.wordpress.org/trunk@50297 git-svn-id: http://core.svn.wordpress.org/trunk@49942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR updated templates provided for the Create Block tool.
It shows how
block.json
format works in practice withregister_block_type_from_metadata
that is close to be final. There is one issue that needs to be resolved separately. There are 3 fields that have different spelling in PHP and JS:api_version
vsapiVersion
provides_context
vsprovidesContext
uses_context
vsusesContext
I plan to tackle it in its own PR. We will also need to update the tutorial Create a Block.
esnext
Block scaffolded with
esnext
template is now registered fromblock.json
with theregister_block_type_from_metadata
helper@wordpress/create-block-tutorial-template
Scaffolded block is now registered from
block.json
with theregister_block_type_from_metadata
helper.How has this been tested?
CI runs static checks for the
esnext
template.I tested it locally with:
npx wp-create-block esnext-example cd esnext-example ../node_modules/.bin/wp-scripts build
Activate the plugin in WordPress and ensure that the block works.
npx wp-create-block tutorial-example --template @wordpress/create-block-tutorial-template cd tutorial-example ../node_modules/.bin/wp-scripts build
Activate the plugin in WordPress and ensure that the block works.
Types of changes
Code quality change and enhancement - code gets simplified.
Checklist: