Improves error message for metadata sections.

This commit is contained in:
mateuswetah 2023-05-25 10:42:47 -03:00
parent 154f9ccaca
commit 91e17d1290
1 changed files with 4 additions and 4 deletions

View File

@ -220,7 +220,7 @@ class Metadata_Section extends Entity {
if ($this->is_conditional_section()) {
$metadata_section_id = $this->get_id();
if ($metadata_section_id == static::$default_section_slug) {
$this->add_error('is_conditional_section', __("conditional section cannot be enabled in default section", 'tainacan'));
$this->add_error('is_conditional_section', __("A conditional section cannot be enabled in default section", 'tainacan'));
$no_errors = false;
} else {
$metadata_list = $this->get_metadata_object_list();
@ -230,19 +230,19 @@ class Metadata_Section extends Entity {
if ( count($required_metadata_list) ) {
$no_errors = false;
foreach($required_metadata_list as $metadata) {
$this->add_error('is_conditional_section', sprintf(__("metadata %s cannot be required", 'tainacan'), $metadata->get_name()));
$this->add_error('is_conditional_section', sprintf(__("Metadatum %s cannot be required inside a conditional section", 'tainacan'), $metadata->get_name()));
}
}
}
}
if( empty($collection) ) {
$this->add_error('required', __("collection is required", 'tainacan'));
$this->add_error('required', __("Collection is required", 'tainacan'));
$no_errors = false;
}
if ( !isset($name) ) {
$this->add_error('required', __("name is required", 'tainacan'));
$this->add_error('required', __("Name is required", 'tainacan'));
$no_errors = false;
}
if($no_errors) {