-
Notifications
You must be signed in to change notification settings - Fork 796
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
Fix missing block translations #33546
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: fixed | ||
|
||
Fix missing block translations |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: bugfix | ||
|
||
Fix missing block translations |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ import './editor.scss'; | |
import './components/feedback/style.scss'; | ||
|
||
registerJetpackBlockFromMetadata( metadata, { | ||
// The API version needs to be explicitly specified in this instance for styles to be loaded. | ||
apiVersion: metadata.apiVersion, | ||
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. Not required anymore. |
||
edit, | ||
save, | ||
} ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,55 +9,60 @@ | |
|
||
use Automattic\Jetpack\Blocks; | ||
|
||
Blocks::jetpack_register_block( | ||
__DIR__, | ||
array( | ||
'render_callback' => array( 'Automattic\\Jetpack\\Extensions\\Recipe\\Jetpack_Recipe_Block', 'render' ), | ||
) | ||
); | ||
add_action( | ||
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. Wrap blocks registration in an init action callback. |
||
'init', | ||
function () { | ||
Blocks::jetpack_register_block( | ||
__DIR__, | ||
array( | ||
'render_callback' => array( 'Automattic\\Jetpack\\Extensions\\Recipe\\Jetpack_Recipe_Block', 'render' ), | ||
) | ||
); | ||
|
||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-details', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
) | ||
); | ||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-details', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
) | ||
); | ||
|
||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-hero', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
'render_callback' => array( 'Automattic\\Jetpack\\Extensions\\Recipe\\Jetpack_Recipe_Block', 'render_hero' ), | ||
) | ||
); | ||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-hero', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
'render_callback' => array( 'Automattic\\Jetpack\\Extensions\\Recipe\\Jetpack_Recipe_Block', 'render_hero' ), | ||
) | ||
); | ||
|
||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-ingredients-list', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
) | ||
); | ||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-ingredients-list', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
) | ||
); | ||
|
||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-ingredient-item', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
) | ||
); | ||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-ingredient-item', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
) | ||
); | ||
|
||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-steps', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
) | ||
); | ||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-steps', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
) | ||
); | ||
|
||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-step', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
'render_callback' => array( 'Automattic\\Jetpack\\Extensions\\Recipe\\Jetpack_Recipe_Block', 'render_step' ), | ||
) | ||
Blocks::jetpack_register_block( | ||
'jetpack/recipe-step', | ||
array( | ||
'parent' => array( 'jetpack/recipe' ), | ||
'render_callback' => array( 'Automattic\\Jetpack\\Extensions\\Recipe\\Jetpack_Recipe_Block', 'render_step' ), | ||
) | ||
); | ||
} | ||
); | ||
|
||
require_once __DIR__ . '/class-jetpack-recipe-block.php'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,21 +212,13 @@ module.exports = [ | |
return metadata; | ||
} | ||
|
||
let scriptName = 'editor'; | ||
|
||
if ( presetIndex.beta.includes( name ) ) { | ||
scriptName += '-beta'; | ||
} else if ( presetIndex.experimental.includes( name ) ) { | ||
scriptName += '-experimental'; | ||
} | ||
|
||
// `editorScript` is required for block.json to be valid and WordPress.org to be able | ||
// to parse it before building the page at https://wordpress.org/plugins/jetpack/. | ||
// Don't add other scripts or styles while block assets are still enqueued manually | ||
// in the backend. | ||
const result = { | ||
...metadata, | ||
editorScript: `file:../${ scriptName }.js`, | ||
editorScript: `jetpack-blocks-editor`, | ||
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. Prevent multiple asset downloads for now since the script is loaded manually on the backend. An |
||
}; | ||
|
||
return JSON.stringify( result, null, 4 ); | ||
|
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.
Required to avoid exception being thrown.