equal
deleted
inserted
replaced
5 * @package WordPress |
5 * @package WordPress |
6 */ |
6 */ |
7 |
7 |
8 /** |
8 /** |
9 * Renders the `core/tag-cloud` block on server. |
9 * Renders the `core/tag-cloud` block on server. |
|
10 * |
|
11 * @since 5.2.0 |
10 * |
12 * |
11 * @param array $attributes The block attributes. |
13 * @param array $attributes The block attributes. |
12 * |
14 * |
13 * @return string Returns the tag cloud for selected taxonomy. |
15 * @return string Returns the tag cloud for selected taxonomy. |
14 */ |
16 */ |
26 'largest' => floatVal( $attributes['largestFontSize'] ), |
28 'largest' => floatVal( $attributes['largestFontSize'] ), |
27 ); |
29 ); |
28 $tag_cloud = wp_tag_cloud( $args ); |
30 $tag_cloud = wp_tag_cloud( $args ); |
29 |
31 |
30 if ( ! $tag_cloud ) { |
32 if ( ! $tag_cloud ) { |
31 $labels = get_taxonomy_labels( get_taxonomy( $attributes['taxonomy'] ) ); |
33 $tag_cloud = __( 'There’s no content to show here yet.' ); |
32 $tag_cloud = esc_html( |
|
33 sprintf( |
|
34 /* translators: %s: taxonomy name */ |
|
35 __( 'Your site doesn’t have any %s, so there’s nothing to display here at the moment.' ), |
|
36 strtolower( $labels->name ) |
|
37 ) |
|
38 ); |
|
39 } |
34 } |
40 |
35 |
41 $wrapper_attributes = get_block_wrapper_attributes(); |
36 $wrapper_attributes = get_block_wrapper_attributes(); |
42 |
37 |
43 return sprintf( |
38 return sprintf( |
47 ); |
42 ); |
48 } |
43 } |
49 |
44 |
50 /** |
45 /** |
51 * Registers the `core/tag-cloud` block on server. |
46 * Registers the `core/tag-cloud` block on server. |
|
47 * |
|
48 * @since 5.2.0 |
52 */ |
49 */ |
53 function register_block_core_tag_cloud() { |
50 function register_block_core_tag_cloud() { |
54 register_block_type_from_metadata( |
51 register_block_type_from_metadata( |
55 __DIR__ . '/tag-cloud', |
52 __DIR__ . '/tag-cloud', |
56 array( |
53 array( |