Editor, I18N: Remove code from a translatable string in `wp_migrate_old_typography_shape()`.

Replace a `trigger_error()` call with `_doing_it_wrong()` for consistency with how similar messages are displayed elsewhere in core.

Follow-up to [51089].

See #52991.
Built from https://develop.svn.wordpress.org/trunk@51153


git-svn-id: http://core.svn.wordpress.org/trunk@50762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-06-15 14:02:59 +00:00
parent 408db6120e
commit 4d3ddd056f
2 changed files with 22 additions and 11 deletions

View File

@ -84,13 +84,16 @@ function register_block_script_handle( $metadata, $field_name ) {
substr_replace( $script_path, '.asset.php', - strlen( '.js' ) )
);
if ( ! file_exists( $script_asset_path ) ) {
$message = sprintf(
/* translators: %1: field name. %2: block name */
__( 'The asset file for the "%1$s" defined in "%2$s" block definition is missing.', 'default' ),
$field_name,
$metadata['name']
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: Field name, 2: Block name. */
__( 'The asset file for the "%1$s" defined in "%2$s" block definition is missing.', 'default' ),
$field_name,
$metadata['name']
),
'5.5.0'
);
_doing_it_wrong( __FUNCTION__, $message, '5.5.0' );
return false;
}
$script_asset = require $script_asset_path;
@ -986,10 +989,18 @@ function wp_migrate_old_typography_shape( $metadata ) {
foreach ( $typography_keys as $typography_key ) {
$support_for_key = _wp_array_get( $metadata['supports'], array( $typography_key ), null );
if ( null !== $support_for_key ) {
trigger_error(
/* translators: %1$s: Block type, %2$s: typography supports key e.g: fontSize, lineHeight etc... */
sprintf( __( 'Block %1$s is declaring %2$s support on block.json under supports.%2$s. %2$s support is now declared under supports.typography.%2$s.' ), $metadata['name'], $typography_key ),
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
_doing_it_wrong(
'register_block_type_from_metadata()',
sprintf(
/* translators: 1: Block type, 2: Typography supports key, e.g: fontSize, lineHeight, etc. 3: block.json, 4: Old metadata key, 5: New metadata key. */
__( 'Block "%1$s" is declaring %2$s support in %3$s file under %4$s. %2$s support is now declared under %5$s.' ),
$metadata['name'],
"<code>$typography_key</code>",
'<code>block.json</code>',
"<code>supports.$typography_key</code>",
"<code>supports.typography.$typography_key</code>"
),
'5.8.0'
);
_wp_array_set( $metadata['supports'], array( 'typography', $typography_key ), $support_for_key );
unset( $metadata['supports'][ $typography_key ] );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-beta1-51152';
$wp_version = '5.8-beta1-51153';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.