WP_REST_View_Config_Controller::get_form_layout_schema │ protected │ WP 7.1.0
Returns the schema for a form layout object as a discriminated union.
Each variant is discriminated by a single-value enum on its type property, matching the TypeScript Layout union in dataviews/src/types/dataform.ts.
Method of the class: WP_REST_View_Config_Controller{}
No Hooks.
Returns
array. Schema for a form layout object.
Usage
// protected - for code of main (parent) or child class
$result = $this->get_form_layout_schema();
Changelog
WP_REST_View_Config_Controller::get_form_layout_schema() WP REST View Config Controller::get form layout schema code
WP 7.1
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',
),
),
),
),
);
}