wp/wp-includes/blocks/calendar.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-includes/blocks/calendar.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/blocks/calendar.php	Tue Dec 15 13:49:49 2020 +0100
@@ -34,7 +34,7 @@
 	$custom_class_name = empty( $attributes['className'] ) ? '' : ' ' . $attributes['className'];
 	$align_class_name  = empty( $attributes['align'] ) ? '' : ' ' . "align{$attributes['align']}";
 
-	return sprintf(
+	$output = sprintf(
 		'<div class="%1$s">%2$s</div>',
 		esc_attr( 'wp-block-calendar' . $custom_class_name . $align_class_name ),
 		get_calendar( true, false )
@@ -44,29 +44,17 @@
 	$monthnum = $previous_monthnum;
 	// phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
 	$year = $previous_year;
+
+	return $output;
 }
 
 /**
  * Registers the `core/calendar` block on server.
  */
 function register_block_core_calendar() {
-	register_block_type(
-		'core/calendar',
+	register_block_type_from_metadata(
+		__DIR__ . '/calendar',
 		array(
-			'attributes'      => array(
-				'align'     => array(
-					'type' => 'string',
-				),
-				'className' => array(
-					'type' => 'string',
-				),
-				'month'     => array(
-					'type' => 'integer',
-				),
-				'year'      => array(
-					'type' => 'integer',
-				),
-			),
 			'render_callback' => 'render_block_core_calendar',
 		)
 	);