Title: WP_REST_View_Config_Controller::get_form_layout_schema
Published: August 20, 2026

---

# WP_REST_View_Config_Controller::get_form_layout_schema(): array

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#wp--skip-link--target)

Returns the schema for a form layout object as a discriminated union.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#description)󠁿

Each variant is discriminated by a single-value enum on its `type` property, matching
the TypeScript Layout union in dataviews/src/types/dataform.ts.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#return)󠁿

 array Schema for a form layout object.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#source)󠁿

    ```php
    protected function get_form_layout_schema() {
    	return array(
    		'oneOf' => array(
    			// RegularLayout.
    			array(
    				'type'       => 'object',
    				'properties' => array(
    					'type'          => array(
    						'type' => 'string',
    						'enum' => array( 'regular' ),
    					),
    					'labelPosition' => array(
    						'type' => 'string',
    						'enum' => array( 'top', 'side', 'none' ),
    					),
    				),
    			),
    			// PanelLayout.
    			array(
    				'type'       => 'object',
    				'properties' => array(
    					'type'           => array(
    						'type' => 'string',
    						'enum' => array( 'panel' ),
    					),
    					'labelPosition'  => array(
    						'type' => 'string',
    						'enum' => array( 'top', 'side', 'none' ),
    					),
    					'openAs'         => array(
    						'oneOf' => array(
    							array(
    								'type' => 'string',
    								'enum' => array( 'dropdown', 'modal' ),
    							),
    							array(
    								'type'       => 'object',
    								'properties' => array(
    									'type'        => array(
    										'type' => 'string',
    										'enum' => array( 'dropdown', 'modal' ),
    									),
    									'applyLabel'  => array(
    										'type' => 'string',
    									),
    									'cancelLabel' => array(
    										'type' => 'string',
    									),
    								),
    							),
    						),
    					),
    					'summary'        => array(
    						'oneOf' => array(
    							array( 'type' => 'string' ),
    							array(
    								'type'  => 'array',
    								'items' => array(
    									'type' => 'string',
    								),
    							),
    						),
    					),
    					'editVisibility' => array(
    						'type' => 'string',
    						'enum' => array( 'always', 'on-hover' ),
    					),
    				),
    			),
    			// CardLayout.
    			array(
    				'type'       => 'object',
    				'properties' => array(
    					'type'          => array(
    						'type' => 'string',
    						'enum' => array( 'card' ),
    					),
    					'withHeader'    => array(
    						'type' => 'boolean',
    					),
    					'isOpened'      => array(
    						'type' => 'boolean',
    					),
    					'isCollapsible' => array(
    						'type' => 'boolean',
    					),
    					'summary'       => array(
    						'oneOf' => array(
    							array( 'type' => 'string' ),
    							array(
    								'type'  => 'array',
    								'items' => array(
    									'oneOf' => array(
    										array( 'type' => 'string' ),
    										array(
    											'type' => 'object',
    											'properties' => array(
    												'id' => array(
    													'type' => 'string',
    												),
    												'visibility' => array(
    													'type' => 'string',
    													'enum' => array( 'always', 'when-collapsed' ),
    												),
    											),
    										),
    									),
    								),
    							),
    						),
    					),
    				),
    			),
    			// RowLayout.
    			array(
    				'type'       => 'object',
    				'properties' => array(
    					'type'      => array(
    						'type' => 'string',
    						'enum' => array( 'row' ),
    					),
    					'alignment' => array(
    						'type' => 'string',
    						'enum' => array( 'start', 'center', 'end' ),
    					),
    					'styles'    => array(
    						'type'                 => 'object',
    						'additionalProperties' => array(
    							'type'       => 'object',
    							'properties' => array(
    								'flex' => array(
    									'type' => array( 'string', 'number' ),
    								),
    							),
    						),
    					),
    				),
    			),
    			// DetailsLayout.
    			array(
    				'type'       => 'object',
    				'properties' => array(
    					'type'    => array(
    						'type' => 'string',
    						'enum' => array( 'details' ),
    					),
    					'summary' => array(
    						'type' => 'string',
    					),
    				),
    			),
    		),
    	);
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php#L632)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php#L632-L785)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_View_Config_Controller::get_form_field_schema()](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_field_schema/)`wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php` |

Returns the schema for a form field item (string or object).

  | 
| [WP_REST_View_Config_Controller::get_form_schema()](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_schema/)`wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php` |

Returns the schema for the form configuration object.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_view_config_controller/get_form_layout_schema/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.1.0](https://developer.wordpress.org/reference/since/7.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_view_config_controller%2Fget_form_layout_schema%2F)
before being able to contribute a note or feedback.