diff --git a/packages/block-library/src/post-author/index.php b/packages/block-library/src/post-author/index.php index 995bc26538864c..6dc30ea5b4ba18 100644 --- a/packages/block-library/src/post-author/index.php +++ b/packages/block-library/src/post-author/index.php @@ -23,10 +23,16 @@ function render_block_core_post_author() { * Registers the `core/post-author` block on the server. */ function register_block_core_post_author() { + $path = __DIR__ . '/post-author/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/post-author', - array( - 'render_callback' => 'render_block_core_post_author', + $metadata['name'], + array_merge( + $metadata, + array( + 'render_callback' => 'render_block_core_post_author', + ) ) ); } diff --git a/packages/block-library/src/post-comments-count/index.php b/packages/block-library/src/post-comments-count/index.php index 9dad7f28d40a5a..0c22f35068f175 100644 --- a/packages/block-library/src/post-comments-count/index.php +++ b/packages/block-library/src/post-comments-count/index.php @@ -32,15 +32,21 @@ function render_block_core_post_comments_count( $attributes ) { * Registers the `core/post-comments-count` block on the server. */ function register_block_core_post_comments_count() { + $path = __DIR__ . '/post-comments-count/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/post-comments-count', - array( - 'attributes' => array( - 'className' => array( - 'type' => 'string', + $metadata['name'], + array_merge( + $metadata, + array( + 'attributes' => array( + 'className' => array( + 'type' => 'string', + ), ), - ), - 'render_callback' => 'render_block_core_post_comments_count', + 'render_callback' => 'render_block_core_post_comments_count', + ) ) ); } diff --git a/packages/block-library/src/post-comments-form/index.php b/packages/block-library/src/post-comments-form/index.php index 43bace1145ebbc..cb1aff17fc5af1 100644 --- a/packages/block-library/src/post-comments-form/index.php +++ b/packages/block-library/src/post-comments-form/index.php @@ -26,10 +26,16 @@ function render_block_core_post_comments_form() { * Registers the `core/post-comments-form` block on the server. */ function register_block_core_post_comments_form() { + $path = __DIR__ . '/post-comments-form/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/post-comments-form', - array( - 'render_callback' => 'render_block_core_post_comments_form', + $metadata['name'], + array_merge( + $metadata, + array( + 'render_callback' => 'render_block_core_post_comments_form', + ) ) ); } diff --git a/packages/block-library/src/post-content/index.php b/packages/block-library/src/post-content/index.php index 5765d383f76061..1e6870fd0b3134 100644 --- a/packages/block-library/src/post-content/index.php +++ b/packages/block-library/src/post-content/index.php @@ -26,10 +26,16 @@ function render_block_core_post_content() { * Registers the `core/post-content` block on the server. */ function register_block_core_post_content() { + $path = __DIR__ . '/post-content/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/post-content', - array( - 'render_callback' => 'render_block_core_post_content', + $metadata['name'], + array_merge( + $metadata, + array( + 'render_callback' => 'render_block_core_post_content', + ) ) ); } diff --git a/packages/block-library/src/post-date/index.php b/packages/block-library/src/post-date/index.php index 56052e0d00a0e6..22e4c53e311eaf 100644 --- a/packages/block-library/src/post-date/index.php +++ b/packages/block-library/src/post-date/index.php @@ -27,15 +27,16 @@ function render_block_core_post_date( $attributes ) { * Registers the `core/post-date` block on the server. */ function register_block_core_post_date() { + $path = __DIR__ . '/post-date/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/post-date', - array( - 'attributes' => array( - 'format' => array( - 'type' => 'string', - ), - ), - 'render_callback' => 'render_block_core_post_date', + $metadata['name'], + array_merge( + $metadata, + array( + 'render_callback' => 'render_block_core_post_date', + ) ) ); } diff --git a/packages/block-library/src/post-excerpt/index.php b/packages/block-library/src/post-excerpt/index.php index c3f1755d0422f0..5d2ee7755beee4 100644 --- a/packages/block-library/src/post-excerpt/index.php +++ b/packages/block-library/src/post-excerpt/index.php @@ -47,23 +47,16 @@ function render_block_core_post_excerpt( $attributes ) { * Registers the `core/post-excerpt` block on the server. */ function register_block_core_post_excerpt() { + $path = __DIR__ . '/post-excerpt/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/post-excerpt', - array( - 'attributes' => array( - 'wordCount' => array( - 'type' => 'number', - 'default' => 55, - ), - 'moreText' => array( - 'type' => 'string', - ), - 'showMoreOnNewLine' => array( - 'type' => 'boolean', - 'default' => true, - ), - ), - 'render_callback' => 'render_block_core_post_excerpt', + $metadata['name'], + array_merge( + $metadata, + array( + 'render_callback' => 'render_block_core_post_excerpt', + ) ) ); } diff --git a/packages/block-library/src/post-featured-image/index.php b/packages/block-library/src/post-featured-image/index.php index cf14f66e90b34d..4a03b2e4d30284 100644 --- a/packages/block-library/src/post-featured-image/index.php +++ b/packages/block-library/src/post-featured-image/index.php @@ -22,10 +22,16 @@ function render_block_core_post_featured_image() { * Registers the `core/post-featured-image` block on the server. */ function register_block_core_post_featured_image() { + $path = __DIR__ . '/post-featured-image/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/post-featured-image', - array( - 'render_callback' => 'render_block_core_post_featured_image', + $metadata['name'], + array_merge( + $metadata, + array( + 'render_callback' => 'render_block_core_post_featured_image', + ) ) ); } diff --git a/packages/block-library/src/post-tags/index.php b/packages/block-library/src/post-tags/index.php index 84a969dac7518e..4fff8d0014c840 100644 --- a/packages/block-library/src/post-tags/index.php +++ b/packages/block-library/src/post-tags/index.php @@ -29,10 +29,16 @@ function render_block_core_post_tags() { * Registers the `core/post-tags` block on the server. */ function register_block_core_post_tags() { + $path = __DIR__ . '/post-tags/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/post-tags', - array( - 'render_callback' => 'render_block_core_post_tags', + $metadata['name'], + array_merge( + $metadata, + array( + 'render_callback' => 'render_block_core_post_tags', + ) ) ); } diff --git a/packages/block-library/src/post-title/index.php b/packages/block-library/src/post-title/index.php index 8b6b372e8faa72..c635ad2a0f0eb9 100644 --- a/packages/block-library/src/post-title/index.php +++ b/packages/block-library/src/post-title/index.php @@ -22,10 +22,16 @@ function render_block_core_post_title() { * Registers the `core/post-title` block on the server. */ function register_block_core_post_title() { + $path = __DIR__ . '/post-title/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/post-title', - array( - 'render_callback' => 'render_block_core_post_title', + $metadata['name'], + array_merge( + $metadata, + array( + 'render_callback' => 'render_block_core_post_title', + ) ) ); } diff --git a/packages/block-library/src/site-title/index.php b/packages/block-library/src/site-title/index.php index eddf094f0300f8..a63760983436e2 100644 --- a/packages/block-library/src/site-title/index.php +++ b/packages/block-library/src/site-title/index.php @@ -24,10 +24,16 @@ function render_block_core_site_title( $attributes ) { * Registers the `core/site-title` block on the server. */ function register_block_core_site_title() { + $path = __DIR__ . '/site-title/block.json'; + $metadata = json_decode( file_get_contents( $path ), true ); + register_block_type( - 'core/site-title', - array( - 'render_callback' => 'render_block_core_site_title', + $metadata['name'], + array_merge( + $metadata, + array( + 'render_callback' => 'render_block_core_site_title', + ) ) ); }