REST_Element_Types_Controller::get_item_schema()

Retrieves the element type’s schema, conforming to JSON Schema.

Description

Return

(array) Element type schema data.

Source

File: src/db-objects/elements/element-types/rest-element-types-controller.php

	public function get_item_schema() {
		$schema = array(
			'$schema'    => 'http://json-schema.org/schema#',
			'title'      => $this->manager->get_singular_slug() . '_type',
			'type'       => 'object',
			'properties' => array(
				'slug'           => array(
					'description' => __( 'Slug for the element type.', 'torro-forms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
				),
				'title'          => array(
					'description' => __( 'Title for the element type.', 'torro-forms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
				),
				'description'    => array(
					'description' => __( 'Description for the element type.', 'torro-forms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
				),
				'icon_css_class' => array(
					'description' => __( 'Icon CSS class for the element type.', 'torro-forms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
				),
				'icon_svg_id'    => array(
					'description' => __( 'Icon SVG ID for the element type.', 'torro-forms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
				),
				'icon_url'       => array(
					'description' => __( 'Icon URL for the element type.', 'torro-forms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
				),
				'non_input'      => array(
					'description' => __( 'Whether the element type does not expect any input.', 'torro-forms' ),
					'type'        => 'boolean',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
				),
				'evaluable'      => array(
					'description' => __( 'Whether the element type is evaluable in stats.', 'torro-forms' ),
					'type'        => 'boolean',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
				),
				'multifield'     => array(
					'description' => __( 'Whether the element type contains multiple fields.', 'torro-forms' ),
					'type'        => 'boolean',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
				),
				'sections'       => array(
					'description' => __( 'Settings sections the element type uses.', 'torro-forms' ),
					'type'        => 'array',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
					'items'       => array(
						'type'       => 'object',
						'properties' => array(
							'slug'  => array(
								'description' => __( 'Slug for the element type settings section.', 'torro-forms' ),
								'type'        => 'string',
								'context'     => array( 'view', 'edit', 'embed' ),
								'readonly'    => true,
							),
							'title' => array(
								'description' => __( 'Title for the element type settings section.', 'torro-forms' ),
								'type'        => 'string',
								'context'     => array( 'view', 'edit', 'embed' ),
								'readonly'    => true,
							),
						),
					),
				),
				'fields'         => array(
					'description' => __( 'Settings fields the element type uses.', 'torro-forms' ),
					'type'        => 'array',
					'context'     => array( 'view', 'edit', 'embed' ),
					'readonly'    => true,
					'items'       => array(
						'type'       => 'object',
						'properties' => array(
							'slug'        => array(
								'description' => __( 'Slug for the element type settings field.', 'torro-forms' ),
								'type'        => 'string',
								'context'     => array( 'view', 'edit', 'embed' ),
								'readonly'    => true,
							),
							'section'     => array(
								'description' => __( 'Slug of the section for the element type settings field.', 'torro-forms' ),
								'type'        => 'string',
								'context'     => array( 'view', 'edit', 'embed' ),
								'readonly'    => true,
							),
							'type'        => array(
								'description' => __( 'Identifier for the field API type the element type settings field uses.', 'torro-forms' ),
								'type'        => 'string',
								'context'     => array( 'view', 'edit', 'embed' ),
								'readonly'    => true,
							),
							'label'       => array(
								'description' => __( 'Label for the element type settings field.', 'torro-forms' ),
								'type'        => 'string',
								'context'     => array( 'view', 'edit', 'embed' ),
								'readonly'    => true,
							),
							'description' => array(
								'description' => __( 'Description for the element type settings field.', 'torro-forms' ),
								'type'        => 'string',
								'context'     => array( 'view', 'edit', 'embed' ),
								'readonly'    => true,
							),
							'is_label'    => array(
								'description' => __( 'Whether the element type settings field determines the element label.', 'torro-forms' ),
								'type'        => 'boolean',
								'context'     => array( 'view', 'edit', 'embed' ),
								'readonly'    => true,
							),
							'is_choices'  => array(
								'description' => __( 'Whether the element type settings field determines element choices.', 'torro-forms' ),
								'type'        => 'boolean',
								'context'     => array( 'view', 'edit', 'embed' ),
								'readonly'    => true,
							),
						),
					),
				),
			),
		);

		return $schema;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.