diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/blocks/archives.php --- a/wp/wp-includes/blocks/archives.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/blocks/archives.php Tue Dec 15 13:49:49 2020 +0100 @@ -72,76 +72,55 @@ '; - $block_content = sprintf( + return sprintf( '
%2$s
', esc_attr( $class ), $block_content ); - } else { - - $class .= ' wp-block-archives-list'; - - /** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */ - $archives_args = apply_filters( - 'widget_archives_args', - array( - 'type' => 'monthly', - 'show_post_count' => $show_post_count, - ) - ); - - $archives_args['echo'] = 0; - - $archives = wp_get_archives( $archives_args ); - - $classnames = esc_attr( $class ); - - if ( empty( $archives ) ) { - - $block_content = sprintf( - '
%2$s
', - $classnames, - __( 'No archives to show.' ) - ); - } else { - - $block_content = sprintf( - '', - $classnames, - $archives - ); - } } - return $block_content; + $class .= ' wp-block-archives-list'; + + /** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */ + $archives_args = apply_filters( + 'widget_archives_args', + array( + 'type' => 'monthly', + 'show_post_count' => $show_post_count, + ) + ); + + $archives_args['echo'] = 0; + + $archives = wp_get_archives( $archives_args ); + + $classnames = esc_attr( $class ); + + if ( empty( $archives ) ) { + + return sprintf( + '
%2$s
', + $classnames, + __( 'No archives to show.' ) + ); + } + + return sprintf( + '', + $classnames, + $archives + ); } /** * Register archives block. */ function register_block_core_archives() { - register_block_type( - 'core/archives', + register_block_type_from_metadata( + __DIR__ . '/archives', array( - 'attributes' => array( - 'align' => array( - 'type' => 'string', - ), - 'className' => array( - 'type' => 'string', - ), - 'displayAsDropdown' => array( - 'type' => 'boolean', - 'default' => false, - ), - 'showPostCounts' => array( - 'type' => 'boolean', - 'default' => false, - ), - ), 'render_callback' => 'render_block_core_archives', ) ); } - add_action( 'init', 'register_block_core_archives' );