Adds more info to collections schema. #792.
This commit is contained in:
parent
757d27ede9
commit
24b57eb628
File diff suppressed because one or more lines are too long
|
@ -52,7 +52,7 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_list_schema'],
|
||||||
));
|
));
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<collection_id>[\d]+)', array(
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<collection_id>[\d]+)', array(
|
||||||
array(
|
array(
|
||||||
|
@ -88,10 +88,15 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'update_metadata_section_order_permissions_check'),
|
'permission_callback' => array($this, 'update_metadata_section_order_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
'collection_id' => [
|
'collection_id' => [
|
||||||
'description' => 'ID da coleção',
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
],
|
],
|
||||||
'metadata_section_order' => $this->collections_repository->get_map()['metadata_section_order']
|
'metadata_section_order' => array_merge(
|
||||||
|
array(
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
$this->collections_repository->get_map()['metadata_section_order']
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_schema'],
|
||||||
|
@ -102,11 +107,13 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'update_metadata_order'),
|
'callback' => array($this, 'update_metadata_order'),
|
||||||
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
|
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
'metadata_order' => [
|
'metadata_order' => array_merge(
|
||||||
'description' => __( 'The order of the metadata in the section, an array of objects with integer ID and bool enabled.', 'tainacan' ),
|
array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
||||||
]
|
),
|
||||||
|
$this->collections_repository->get_map()['metadata_order']
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_schema'],
|
||||||
|
@ -117,11 +124,13 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'update_metadata_order'),
|
'callback' => array($this, 'update_metadata_order'),
|
||||||
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
|
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
'metadata_order' => [
|
'metadata_order' => array_merge(
|
||||||
'description' => __( 'The order of the metadata in the section, an array of objects with integer ID and bool enabled.', 'tainacan' ),
|
array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
||||||
]
|
),
|
||||||
|
$this->collections_repository->get_map()['metadata_order']
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_schema'],
|
||||||
|
@ -132,11 +141,13 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'update_filters_order'),
|
'callback' => array($this, 'update_filters_order'),
|
||||||
'permission_callback' => array($this, 'update_filters_order_permissions_check'),
|
'permission_callback' => array($this, 'update_filters_order_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
'filters_order' => [
|
'filters_order' => array_merge(
|
||||||
'description' => __( 'The order of the filters in the collection, an array of objects with integer ID and bool enabled.', 'tainacan' ),
|
array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
||||||
]
|
),
|
||||||
|
$this->collections_repository->get_map()['filters_order']
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_schema'],
|
||||||
|
@ -890,7 +901,7 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
'title' => 'collection',
|
'title' => 'collection',
|
||||||
'type' => 'object',
|
'type' => 'object',
|
||||||
'tags' => ['collection'],
|
'tags' => [ 'collection' ],
|
||||||
];
|
];
|
||||||
|
|
||||||
$main_schema = parent::get_repository_schema( $this->collections_repository );
|
$main_schema = parent::get_repository_schema( $this->collections_repository );
|
||||||
|
@ -903,7 +914,18 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
);
|
);
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_list_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => 'collections',
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => $this->get_schema(),
|
||||||
|
'tags' => ['collection'],
|
||||||
|
];
|
||||||
|
return $schema;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,53 +28,53 @@ class Collections extends Repository {
|
||||||
*/
|
*/
|
||||||
protected function _get_map() {
|
protected function _get_map() {
|
||||||
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
||||||
'name' => [
|
'name' => [
|
||||||
'map' => 'post_title',
|
'map' => 'post_title',
|
||||||
'title' => __( 'Name', 'tainacan' ),
|
'title' => __( 'Name', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The title of the collection', 'tainacan' ),
|
'description' => __( 'The title of the collection', 'tainacan' ),
|
||||||
'validation' => v::stringType()->notEmpty(),
|
'validation' => v::stringType()->notEmpty(),
|
||||||
],
|
],
|
||||||
'status' => [
|
'status' => [
|
||||||
'map' => 'post_status',
|
'map' => 'post_status',
|
||||||
'title' => __( 'Status', 'tainacan' ),
|
'title' => __( 'Status', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'description' => __( 'The current situation of the collection. It also affects the visibility of the collection items, as public items from private collections do not appear in the site.', 'tainacan' )
|
'description' => __( 'The current situation of the collection. It also affects the visibility of the collection items, as public items from private collections do not appear in the site.', 'tainacan' )
|
||||||
],
|
],
|
||||||
'author_id' => [
|
'author_id' => [
|
||||||
'map' => 'post_author',
|
'map' => 'post_author',
|
||||||
'title' => __( 'Author ID', 'tainacan' ),
|
'title' => __( 'Author ID', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The collection author\'s user ID (numeric string)', 'tainacan' )
|
'description' => __( 'The collection author\'s user ID (numeric string)', 'tainacan' )
|
||||||
],
|
],
|
||||||
'creation_date' => [
|
'creation_date' => [
|
||||||
'map' => 'post_date',
|
'map' => 'post_date',
|
||||||
'title' => __( 'Creation Date', 'tainacan' ),
|
'title' => __( 'Creation Date', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The collection creation date', 'tainacan' )
|
'description' => __( 'The collection creation date', 'tainacan' )
|
||||||
],
|
],
|
||||||
'modification_date' => [
|
'modification_date' => [
|
||||||
'map' => 'post_modified',
|
'map' => 'post_modified',
|
||||||
'title' => __( 'Modification Date', 'tainacan' ),
|
'title' => __( 'Modification Date', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The collection modification date', 'tainacan' )
|
'description' => __( 'The collection modification date', 'tainacan' )
|
||||||
],
|
],
|
||||||
'order' => [
|
'order' => [
|
||||||
'map' => 'order',
|
'map' => 'order',
|
||||||
'title' => __( 'Order', 'tainacan' ),
|
'title' => __( 'Order', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Collection order. This metadata is used if collections are manually ordered.', 'tainacan' ),
|
'description' => __( 'Collection order. This metadata is used if collections are manually ordered.', 'tainacan' ),
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'parent' => [
|
'parent' => [
|
||||||
'map' => 'post_parent',
|
'map' => 'post_parent',
|
||||||
'title' => __( 'Parent Collection', 'tainacan' ),
|
'title' => __( 'Parent Collection', 'tainacan' ),
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
'description' => __( 'Original collection from which features are inherited', 'tainacan' ),
|
'description' => __( 'Original collection from which features are inherited', 'tainacan' ),
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'description' => [
|
'description' => [
|
||||||
'map' => 'post_content',
|
'map' => 'post_content',
|
||||||
'title' => __( 'Description', 'tainacan' ),
|
'title' => __( 'Description', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
@ -82,14 +82,14 @@ class Collections extends Repository {
|
||||||
'default' => '',
|
'default' => '',
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'slug' => [
|
'slug' => [
|
||||||
'map' => 'post_name',
|
'map' => 'post_name',
|
||||||
'title' => __( 'Slug', 'tainacan' ),
|
'title' => __( 'Slug', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'An unique and sanitized string representation of the collection, used to build the collection URL. It must not contain any special characters or spaces.', 'tainacan' ),
|
'description' => __( 'An unique and sanitized string representation of the collection, used to build the collection URL. It must not contain any special characters or spaces.', 'tainacan' ),
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'default_orderby' => [
|
'default_orderby' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default order metadata', 'tainacan' ),
|
'title' => __( 'Default order metadata', 'tainacan' ),
|
||||||
'type' => ['string', 'array', 'object'],
|
'type' => ['string', 'array', 'object'],
|
||||||
|
@ -97,12 +97,13 @@ class Collections extends Repository {
|
||||||
'default' => 'date',
|
'default' => 'date',
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'default_order' => [
|
'default_order' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default order', 'tainacan' ),
|
'title' => __( 'Default order', 'tainacan' ),
|
||||||
'description' => __( 'Default order for items in this collection. ASC or DESC', 'tainacan' ),
|
'description' => __( 'Default order for items in this collection. ASC or DESC', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'default' => 'ASC',
|
'default' => 'ASC',
|
||||||
|
'enum' => [ 'ASC', 'DESC' ],
|
||||||
'validation' => v::stringType()->in( [ 'ASC', 'DESC' ] ),
|
'validation' => v::stringType()->in( [ 'ASC', 'DESC' ] ),
|
||||||
],
|
],
|
||||||
'default_displayed_metadata' => [
|
'default_displayed_metadata' => [
|
||||||
|
@ -114,7 +115,7 @@ class Collections extends Repository {
|
||||||
'description' => __( 'List of collection properties that will be displayed in the table view', 'tainacan' ),
|
'description' => __( 'List of collection properties that will be displayed in the table view', 'tainacan' ),
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'default_view_mode' => [
|
'default_view_mode' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default view mode', 'tainacan' ),
|
'title' => __( 'Default view mode', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
@ -122,7 +123,7 @@ class Collections extends Repository {
|
||||||
'default' => 'table',
|
'default' => 'table',
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'enabled_view_modes' => [
|
'enabled_view_modes' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Enabled view modes', 'tainacan' ),
|
'title' => __( 'Enabled view modes', 'tainacan' ),
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
|
@ -131,39 +132,39 @@ class Collections extends Repository {
|
||||||
'items' => [ 'type' => 'string' ],
|
'items' => [ 'type' => 'string' ],
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'metadata_section_order' => [
|
'metadata_section_order' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Metadata order', 'tainacan' ),
|
'title' => __( 'Metadata order', 'tainacan' ),
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'items' => [
|
'items' => [
|
||||||
'type' => 'object',
|
'type' => 'object',
|
||||||
'properties' => [
|
'properties' => [
|
||||||
"id" => [
|
'id' => [
|
||||||
"description" => "ID of metadata section",
|
'description' => __( 'Metadata Section ID', 'tainacan' ),
|
||||||
"type" => "integer",
|
'type' => 'integer',
|
||||||
],
|
],
|
||||||
"enabled" => [
|
'enabled' => [
|
||||||
"description" => "If metadata section is enabled.",
|
'description' => __( 'Whether the metadata section is enabled or not.', 'tainacan' ),
|
||||||
"type" => "boolean",
|
'type' => 'boolean',
|
||||||
],
|
],
|
||||||
"metadata_order" => [
|
'metadata_order' => [
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'description' => 'Array with order of the metadata inside section',
|
'description' => __( 'Array containing the metadata order inside the section', 'tainacan' ),
|
||||||
'items' => [
|
'items' => [
|
||||||
'type' => 'object',
|
'type' => 'object',
|
||||||
'properties' => [
|
'properties' => [
|
||||||
"id" => [
|
'id' => [
|
||||||
"description" => "ID of metadata.",
|
'description' => __( 'Metadata ID', 'tainacan' ),
|
||||||
"type" => "integer"
|
'type' => 'integer'
|
||||||
],
|
],
|
||||||
"enabled" => [
|
'enabled' => [
|
||||||
"description" => "If metadata is enabled.",
|
'description' => __( 'Whether the metadata is enabled or not.', 'tainacan' ),
|
||||||
"type" => "boolean"
|
'type' => 'boolean'
|
||||||
]
|
]
|
||||||
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'description' => __( 'The order of the metadata section in the collection', 'tainacan' ),
|
'description' => __( 'The order of the metadata section in the collection', 'tainacan' ),
|
||||||
|
@ -171,17 +172,41 @@ class Collections extends Repository {
|
||||||
'metadata_order' => [
|
'metadata_order' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Metadata order', 'tainacan' ),
|
'title' => __( 'Metadata order', 'tainacan' ),
|
||||||
'type' => ['array', 'object', 'string'],
|
'type' => 'array',
|
||||||
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
|
|
||||||
'description' => __( 'The order of the metadata in the collection', 'tainacan' ),
|
'description' => __( 'The order of the metadata in the collection', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'description' => __( 'Metadata ID', 'tainacan' ),
|
||||||
|
'type' => 'integer'
|
||||||
|
],
|
||||||
|
'enabled' => [
|
||||||
|
'description' => __( 'Whether the metadata is enabled or not.', 'tainacan' ),
|
||||||
|
'type' => 'boolean'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'filters_order' => [
|
'filters_order' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Filters order', 'tainacan' ),
|
'title' => __( 'Filters order', 'tainacan' ),
|
||||||
'type' => ['array', 'object', 'string'],
|
'type' => 'array',
|
||||||
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
|
|
||||||
'description' => __( 'The order of the filters in the collection', 'tainacan' ),
|
'description' => __( 'The order of the filters in the collection', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'description' => __( 'Filter ID', 'tainacan' ),
|
||||||
|
'type' => 'integer'
|
||||||
|
],
|
||||||
|
'enabled' => [
|
||||||
|
'description' => __( 'Whether the filter is enabled or not.', 'tainacan' ),
|
||||||
|
'type' => 'boolean'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'enable_cover_page' => [
|
'enable_cover_page' => [
|
||||||
|
@ -190,6 +215,7 @@ class Collections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'To use this page as the home page of this collection', 'tainacan' ),
|
'description' => __( 'To use this page as the home page of this collection', 'tainacan' ),
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
|
@ -223,7 +249,8 @@ class Collections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Collection comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
'description' => __( 'Collection comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
||||||
'default' => get_default_comment_status(Entities\Collection::get_post_type()),
|
'default' => get_default_comment_status(Entities\Collection::get_post_type()),
|
||||||
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
'enum' => [ 'open', 'closed' ],
|
||||||
|
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
||||||
],
|
],
|
||||||
'allow_comments' => [
|
'allow_comments' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
|
@ -231,30 +258,33 @@ class Collections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'If this option is enabled, items of this collection can be set to enable a comments section on their page. "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
'description' => __( 'If this option is enabled, items of this collection can be set to enable a comments section on their page. "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
||||||
'default' => 'closed',
|
'default' => 'closed',
|
||||||
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
'enum' => [ 'open', 'close' ],
|
||||||
|
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
||||||
],
|
],
|
||||||
'submission_anonymous_user' => [
|
'submission_anonymous_user' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Allows submission by anonymous user', 'tainacan' ),
|
'title' => __( 'Allows submission by anonymous user', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'If enabled, allows submission by anonymous users, whose does not have to be logged in with permissions on the WordPress system.', 'tainacan' ),
|
'description' => __( 'If enabled, allows submission by anonymous users, whose does not have to be logged in with permissions on the WordPress system.', 'tainacan' ),
|
||||||
'default' => 'no',
|
'default' => 'no',
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
],
|
],
|
||||||
'submission_default_status' => [
|
'submission_default_status' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default submission item status', 'tainacan' ),
|
'title' => __( 'Default submission item status', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The default status of the item that will be created in the collection after submission.', 'tainacan' ),
|
'description' => __( 'The default status of the item that will be created in the collection after submission.', 'tainacan' ),
|
||||||
'default' => 'draft'
|
'default' => 'draft'
|
||||||
],
|
],
|
||||||
'allows_submission' => [
|
'allows_submission' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Allows item submission', 'tainacan' ),
|
'title' => __( 'Allows item submission', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'If enabled, the collection allows item submission, for example via the Item Submission block.', 'tainacan' ),
|
'description' => __( 'If enabled, the collection allows item submission, for example via the Item Submission block.', 'tainacan' ),
|
||||||
'default' => 'no',
|
'default' => 'no',
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
],
|
],
|
||||||
|
@ -264,24 +294,40 @@ class Collections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Enable this option to never display the item thumbnail on the items list. This is ment for collections made of mainly textual content.', 'tainacan' ),
|
'description' => __( 'Enable this option to never display the item thumbnail on the items list. This is ment for collections made of mainly textual content.', 'tainacan' ),
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
'submission_use_recaptcha' => [
|
'submission_use_recaptcha' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Use reCAPTCHA verification on submission form', 'tainacan' ),
|
'title' => __( 'Use reCAPTCHA verification on submission form', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'If enabled, the collection allows item submission using a reCAPTCHA', 'tainacan' ),
|
'description' => __( 'If enabled, the collection allows item submission using a reCAPTCHA', 'tainacan' ),
|
||||||
'default' => 'no',
|
'default' => 'no',
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
],
|
],
|
||||||
'default_metadata_section_properties' => [
|
'default_metadata_section_properties' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default metadata section properties', 'tainacan' ),
|
'title' => __( 'Default metadata section properties', 'tainacan' ),
|
||||||
'type' => 'object',
|
'type' => 'object',
|
||||||
'items' => [ 'name' => 'string', 'description' => 'string', 'description_bellow_name' => 'string' ],
|
|
||||||
'description' => __( 'The default metadata section properties', 'tainacan' ),
|
'description' => __( 'The default metadata section properties', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The name of the default metadata section', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'description' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The description of the default metadata section', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'description_bellow_name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Whether the description should appear bellow the metadata section.', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ]
|
||||||
|
]
|
||||||
|
]
|
||||||
],
|
],
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue