From 4d3ddd056fa481c48795426c8963dcd76177401d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 15 Jun 2021 14:02:59 +0000 Subject: [PATCH] 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 --- wp-includes/blocks.php | 31 +++++++++++++++++++++---------- wp-includes/version.php | 2 +- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 4e90fde121..bf87b0f82e 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -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'], + "$typography_key", + 'block.json', + "supports.$typography_key", + "supports.typography.$typography_key" + ), + '5.8.0' ); _wp_array_set( $metadata['supports'], array( 'typography', $typography_key ), $support_for_key ); unset( $metadata['supports'][ $typography_key ] ); diff --git a/wp-includes/version.php b/wp-includes/version.php index b6fa724d71..056c1d876a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.