add mapped property `submission_anonymous_user` #388

This commit is contained in:
vnmedeiros 2020-09-17 10:37:19 -03:00
parent d742c7c63a
commit 77830a4a4f
2 changed files with 30 additions and 2 deletions

View File

@ -34,7 +34,8 @@ class Collection extends Entity {
$header_image_id, $header_image_id,
$header_image, $header_image,
$comment_status, $comment_status,
$allow_comments; $allow_comments,
$submission_anonymous_user;
/** /**
* {@inheritDoc} * {@inheritDoc}
@ -543,6 +544,15 @@ class Collection extends Entity {
return $this->get_mapped_property('allow_comments'); return $this->get_mapped_property('allow_comments');
} }
/**
* Get enable submission with anonymous user
*
* @return string
*/
function get_submission_anonymous_user() {
return $this->get_mapped_property( 'submission_anonymous_user' ) != 'false';
}
/** /**
* Set the collection name * Set the collection name
* *
@ -732,6 +742,17 @@ class Collection extends Entity {
$this->set_mapped_property('allow_comments', $value ); $this->set_mapped_property('allow_comments', $value );
} }
/**
* Set enable submission with anonymous user
*
* @param [boolean] $value
*
* @return void
*/
function set_submission_anonymous_user( $value ) {
$this->set_mapped_property( 'submission_anonymous_user', $value );
}
/** /**
* Validate Collection * Validate Collection
* *

View File

@ -194,7 +194,14 @@ class Collections extends Repository {
'description' => __( 'Collection items comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ), 'description' => __( 'Collection items comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
'default' => 'open', 'default' => 'open',
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )), 'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
] ],
'submission_anonymous_user' => [
'map' => 'meta',
'title' => __( 'Allows submission by anonymous user', 'tainacan' ),
'type' => 'boolean',
'description' => __( 'If enabled, allows submission by anonymous user.', 'tainacan' ),
'default' => 'false'
],
] ); ] );
} }