--- a/wp/wp-includes/class-wp-block-type-registry.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/class-wp-block-type-registry.php Wed Sep 21 18:19:35 2022 +0200
@@ -34,17 +34,14 @@
*
* @since 5.0.0
*
+ * @see WP_Block_Type::__construct()
+ *
* @param string|WP_Block_Type $name Block type name including namespace, or alternatively
* a complete WP_Block_Type instance. In case a WP_Block_Type
* is provided, the $args parameter will be ignored.
- * @param array $args {
- * Optional. Array of block type arguments. Accepts any public property of `WP_Block_Type`.
- * Any arguments may be defined, however the ones described below are supported by default.
- * Default empty array.
- *
- * @type callable $render_callback Callback used to render blocks of this block type.
- * @type array $attributes Block attributes mapping, property name to schema.
- * }
+ * @param array $args Optional. Array of block type arguments. Accepts any public property
+ * of `WP_Block_Type`. See WP_Block_Type::__construct() for information
+ * on accepted arguments. Default empty array.
* @return WP_Block_Type|false The registered block type on success, or false on failure.
*/
public function register( $name, $args = array() ) {
@@ -55,28 +52,40 @@
}
if ( ! is_string( $name ) ) {
- $message = __( 'Block type names must be strings.' );
- _doing_it_wrong( __METHOD__, $message, '5.0.0' );
+ _doing_it_wrong(
+ __METHOD__,
+ __( 'Block type names must be strings.' ),
+ '5.0.0'
+ );
return false;
}
if ( preg_match( '/[A-Z]+/', $name ) ) {
- $message = __( 'Block type names must not contain uppercase characters.' );
- _doing_it_wrong( __METHOD__, $message, '5.0.0' );
+ _doing_it_wrong(
+ __METHOD__,
+ __( 'Block type names must not contain uppercase characters.' ),
+ '5.0.0'
+ );
return false;
}
$name_matcher = '/^[a-z0-9-]+\/[a-z0-9-]+$/';
if ( ! preg_match( $name_matcher, $name ) ) {
- $message = __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' );
- _doing_it_wrong( __METHOD__, $message, '5.0.0' );
+ _doing_it_wrong(
+ __METHOD__,
+ __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' ),
+ '5.0.0'
+ );
return false;
}
if ( $this->is_registered( $name ) ) {
- /* translators: %s: Block name. */
- $message = sprintf( __( 'Block type "%s" is already registered.' ), $name );
- _doing_it_wrong( __METHOD__, $message, '5.0.0' );
+ _doing_it_wrong(
+ __METHOD__,
+ /* translators: %s: Block name. */
+ sprintf( __( 'Block type "%s" is already registered.' ), $name ),
+ '5.0.0'
+ );
return false;
}
@@ -104,9 +113,12 @@
}
if ( ! $this->is_registered( $name ) ) {
- /* translators: %s: Block name. */
- $message = sprintf( __( 'Block type "%s" is not registered.' ), $name );
- _doing_it_wrong( __METHOD__, $message, '5.0.0' );
+ _doing_it_wrong(
+ __METHOD__,
+ /* translators: %s: Block name. */
+ sprintf( __( 'Block type "%s" is not registered.' ), $name ),
+ '5.0.0'
+ );
return false;
}