-
Notifications
You must be signed in to change notification settings - Fork 798
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
Enable block registration by specifying the path to block.json #32697
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
2d37e5e
to
61f2abf
Compare
@@ -99,7 +115,53 @@ function () use ( $feature_name, $method_name ) { | |||
} | |||
} | |||
|
|||
return register_block_type( $slug, $args ); | |||
return register_block_type( isset( $block_type ) ? $block_type : $slug, $args ); |
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.
Just a small nitpick, maybe we could avoid using the ternary operator inside the function call and instead declare some new variable using it there.
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.
Sure thing. I'm just curious why: is it a WordPress or A8C best practice?
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'm not sure if it is a formal "best practice", but I can see where it is harder to parse while reading what is being returned with the operator in there.
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.
bfcfea7
to
100c54d
Compare
Unit test failures
|
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.
This looks good to me now, it should be good to go imo!
Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
Following #32697, 'registerJetpackBlockFromMetadata' is now used to register some Jetpack blocks from metadata. As such, we need to support that functionality on native. With this commit, the function has been copied/pasted to the native file for use registering Jetpack blocks in the app.
See #32602
Proposed changes:
Allows the registration of blocks by passing the path to the
block.json
metadata file toBlocks::jetpack_register_block
.In more details:
Blocks::jetpack_register_block
andJetpack_Gutenberg::load_assets_as_required
to accept a path as first argumentbeta
mention is only rendered onceregisterJetpackBlock
accept both prefixed and unprefixed namesOther information:
Jetpack product discussion
pedMtX-RS-p2
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
Regression testing:
Functional testing: