-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 templates to use APIs introduced in WP 6.1 #44185
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
File renamed without changes.
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
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
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
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
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
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
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
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
2 changes: 1 addition & 1 deletion
2
...lib/templates/block/template.php.mustache → ...k/lib/templates/block/render.php.mustache
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{{#isDynamicVariant}} | ||
<p <?php echo get_block_wrapper_attributes(); ?>> | ||
<?php esc_html_e( '{{title}} – hello from a dynamic block!', '{{textdomain}}' ); ?> | ||
<?php esc_html_e( '{{title}} – hello from a dynamic block!', '{{textdomain}}' ); ?> | ||
</p> | ||
{{/isDynamicVariant}} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,53 +33,6 @@ | |
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ | ||
*/ | ||
registerBlockType( '{{namespace}}/{{slug}}', { | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removed code is loading from |
||
* @see https://make.wordpress.org/core/2020/11/18/block-api-version-2/ | ||
*/ | ||
apiVersion: {{apiVersion}}, | ||
|
||
/** | ||
* This is the display title for your block, which can be translated with `i18n` functions. | ||
* The block inserter will show this name. | ||
*/ | ||
title: __( | ||
'{{title}}', | ||
'{{textdomain}}' | ||
), | ||
|
||
{{#description}} | ||
/** | ||
* This is a short description for your block, can be translated with `i18n` functions. | ||
* It will be shown in the Block Tab in the Settings Sidebar. | ||
*/ | ||
description: __( | ||
'{{description}}', | ||
'{{textdomain}}' | ||
), | ||
|
||
{{/description}} | ||
/** | ||
* Blocks are grouped into categories to help users browse and discover them. | ||
* The categories provided by core are `text`, `media`, `design`, `widgets`, and `embed`. | ||
*/ | ||
category: '{{category}}', | ||
|
||
{{#dashicon}} | ||
/** | ||
* An icon property should be specified to make it easier to identify a block. | ||
* These can be any of WordPress’ Dashicons, or a custom svg element. | ||
*/ | ||
icon: '{{dashicon}}', | ||
|
||
{{/dashicon}} | ||
/** | ||
* Optional block extended support features. | ||
*/ | ||
supports: { | ||
// Removes support for an HTML mode. | ||
html: false, | ||
}, | ||
|
||
/** | ||
* The edit function describes the structure of your block in the context of the editor. | ||
* This represents what the editor will render when the block is used. | ||
|
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
2 changes: 1 addition & 1 deletion
2
...k/lib/templates/es5/template.php.mustache → ...ock/lib/templates/es5/render.php.mustache
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{{#isDynamicVariant}} | ||
<p <?php echo get_block_wrapper_attributes(); ?>> | ||
<?php esc_html_e( '{{title}} – hello from a dynamic block!', '{{textdomain}}' ); ?> | ||
<?php esc_html_e( '{{title}} – hello from a dynamic block!', '{{textdomain}}' ); ?> | ||
</p> | ||
{{/isDynamicVariant}} |
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
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
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.
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.
For now, I had to leave it as is, but I hope we can figure out a way to move all JS and CSS registration to
block.json
when someone opts out from using build tools. Tracked in #40447.