mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-07 01:39:04 +00:00
Blocks: Add support for variations in block.json` file
We integrated variations with block types and the corresponding REST API endpoint in #52688. It's a follow-up patch to add missing support to the `block.json` metadata file when using `register_block_type`. Some fields for variations are translatable.Therefore, i18n schema was copied over from Gutenberg: https://github.com/WordPress/gutenberg/blob/trunk/packages/blocks/src/api/i18n-block.json. The accompanying implementation was adapted as `translate_settings_using_i18n_schema`. Props: gwwar, swissspidy, schlessera, jorgefilipecosta. Fixes #53238. git-svn-id: https://develop.svn.wordpress.org/trunk@51599 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -44,53 +44,6 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
|
||||
return 'pl_PL';
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 52991
|
||||
*/
|
||||
public function test_fields_are_extracted() {
|
||||
$actual = WP_Theme_JSON_Resolver::get_fields_to_translate();
|
||||
|
||||
$expected = array(
|
||||
array(
|
||||
'path' => array( 'settings', 'typography', 'fontSizes' ),
|
||||
'key' => 'name',
|
||||
'context' => 'Font size name',
|
||||
),
|
||||
array(
|
||||
'path' => array( 'settings', 'color', 'palette' ),
|
||||
'key' => 'name',
|
||||
'context' => 'Color name',
|
||||
),
|
||||
array(
|
||||
'path' => array( 'settings', 'color', 'gradients' ),
|
||||
'key' => 'name',
|
||||
'context' => 'Gradient name',
|
||||
),
|
||||
array(
|
||||
'path' => array( 'settings', 'color', 'duotone' ),
|
||||
'key' => 'name',
|
||||
'context' => 'Duotone name',
|
||||
),
|
||||
array(
|
||||
'path' => array( 'settings', 'blocks', '*', 'typography', 'fontSizes' ),
|
||||
'key' => 'name',
|
||||
'context' => 'Font size name',
|
||||
),
|
||||
array(
|
||||
'path' => array( 'settings', 'blocks', '*', 'color', 'palette' ),
|
||||
'key' => 'name',
|
||||
'context' => 'Color name',
|
||||
),
|
||||
array(
|
||||
'path' => array( 'settings', 'blocks', '*', 'color', 'gradients' ),
|
||||
'key' => 'name',
|
||||
'context' => 'Gradient name',
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertSame( $expected, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 52991
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user