Commit 71992447a6 for wordpress.org
commit 71992447a62607df9f73fc4164af43164902714e
Author: ntsekouras <ntsekouras@git.wordpress.org>
Date: Tue Sep 8 11:32:51 2026 +0000
View config: Add the `showPlaceholderIfEmpty` option to the panel form layout schema.
Adds a boolean `showPlaceholderIfEmpty` property to the panel form layout in the view config REST schema. When true, the panel summary shows the field's `placeholder` instead of its `render` output when the value is empty (`undefined`, `null`, or an empty string). It is `false` by default, so existing forms are unchanged. Schema only, no behavior changes on the server.
Ports the changes from the Gutenberg plugin. See https://github.com/WordPress/gutenberg/pull/82527.
Props ntsekouras, oandregal.
Part of #65981.
Built from https://develop.svn.wordpress.org/trunk@63530
git-svn-id: http://core.svn.wordpress.org/trunk@62706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php
index 2209e449ea..da379cc6c8 100644
--- a/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php
+++ b/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php
@@ -631,6 +631,7 @@ class WP_REST_View_Config_Controller extends WP_REST_Controller {
* matching the TypeScript Layout union in dataviews/src/types/dataform.ts.
*
* @since 7.1.0
+ * @since 7.2.0 Added the `showPlaceholderIfEmpty` property to the panel layout.
*
* @return array Schema for a form layout object.
*/
@@ -655,15 +656,15 @@ class WP_REST_View_Config_Controller extends WP_REST_Controller {
array(
'type' => 'object',
'properties' => array(
- 'type' => array(
+ 'type' => array(
'type' => 'string',
'enum' => array( 'panel' ),
),
- 'labelPosition' => array(
+ 'labelPosition' => array(
'type' => 'string',
'enum' => array( 'top', 'side', 'none' ),
),
- 'openAs' => array(
+ 'openAs' => array(
'oneOf' => array(
array(
'type' => 'string',
@@ -686,7 +687,7 @@ class WP_REST_View_Config_Controller extends WP_REST_Controller {
),
),
),
- 'summary' => array(
+ 'summary' => array(
'oneOf' => array(
array( 'type' => 'string' ),
array(
@@ -697,10 +698,13 @@ class WP_REST_View_Config_Controller extends WP_REST_Controller {
),
),
),
- 'editVisibility' => array(
+ 'editVisibility' => array(
'type' => 'string',
'enum' => array( 'always', 'on-hover' ),
),
+ 'showPlaceholderIfEmpty' => array(
+ 'type' => 'boolean',
+ ),
),
),
// CardLayout.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index c219e192bd..823a4ec357 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-63529';
+$wp_version = '7.2-alpha-63530';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.