fix: fix: validate when the metadata value is `0` and required

This commit is contained in:
vnmedeiros 2021-04-07 12:32:35 -03:00
parent 52acf6f8ad
commit 5bce09fde8
2 changed files with 2 additions and 2 deletions

View File

@ -470,7 +470,7 @@ class Item_Metadata_Entity extends Entity {
return false;
}
if (empty($value)) {
if (empty($value) && $value !== '0' && $value !== 0) {
if ($this->is_required()) {
$validation_statuses = ['publish', 'future', 'private'];
if (in_array($item->get_status(), apply_filters( 'tainacan-status-require-validation', $validation_statuses) )) {

View File

@ -168,7 +168,7 @@ class Metadatum extends Entity {
/**
* Return the an object child of \Tainacan\metadatum_Types\Metadata_Type with options
*
* @return \Tainacan\Metadata_Types\Metadata_Type The metadatum type class with filled options
* @return \Tainacan\Metadata_Types\Metadata_Type|Object The metadatum type class with filled options
*/
function get_metadata_type_object(){
$class_name = $this->get_metadata_type();