wp/wp-includes/blocks/tag-cloud.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-includes/blocks/tag-cloud.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/blocks/tag-cloud.php	Tue Dec 15 13:49:49 2020 +0100
@@ -30,7 +30,14 @@
 	$tag_cloud = wp_tag_cloud( $args );
 
 	if ( ! $tag_cloud ) {
-		$tag_cloud = esc_html( __( 'No terms to show.' ) );
+		$labels    = get_taxonomy_labels( get_taxonomy( $attributes['taxonomy'] ) );
+		$tag_cloud = esc_html(
+			sprintf(
+				/* translators: %s: taxonomy name */
+				__( 'Your site doesn’t have any %s, so there’s nothing to display here at the moment.' ),
+				strtolower( $labels->name )
+			)
+		);
 	}
 
 	return sprintf(
@@ -44,28 +51,11 @@
  * Registers the `core/tag-cloud` block on server.
  */
 function register_block_core_tag_cloud() {
-	register_block_type(
-		'core/tag-cloud',
+	register_block_type_from_metadata(
+		__DIR__ . '/tag-cloud',
 		array(
-			'attributes'      => array(
-				'taxonomy'      => array(
-					'type'    => 'string',
-					'default' => 'post_tag',
-				),
-				'className'     => array(
-					'type' => 'string',
-				),
-				'showTagCounts' => array(
-					'type'    => 'boolean',
-					'default' => false,
-				),
-				'align'         => array(
-					'type' => 'string',
-				),
-			),
 			'render_callback' => 'render_block_core_tag_cloud',
 		)
 	);
 }
-
 add_action( 'init', 'register_block_core_tag_cloud' );