fix: input type to single value on create new metadata for taxonomy

This commit is contained in:
vnmedeiros 2020-11-03 17:55:26 -03:00
parent ac0edcff7c
commit 50a557f65f
1 changed files with 13 additions and 5 deletions

View File

@ -980,11 +980,19 @@ abstract class Importer {
if( $taxonomy->validate() ){ if( $taxonomy->validate() ){
$inserted_tax = $taxonomy_repo->insert( $taxonomy ); $inserted_tax = $taxonomy_repo->insert( $taxonomy );
if(is_array($properties) && in_array( 'multiple', $properties) ){
$newMetadatum->set_metadata_type_options([ $newMetadatum->set_metadata_type_options([
'taxonomy_id' => $inserted_tax->get_id(), 'taxonomy_id' => $inserted_tax->get_id(),
'allow_new_terms' => 'yes', 'allow_new_terms' => 'yes',
'input_type' => 'tainacan-taxonomy-checkbox' 'input_type' => 'tainacan-taxonomy-checkbox'
]); ]);
} else {
$newMetadatum->set_metadata_type_options([
'taxonomy_id' => $inserted_tax->get_id(),
'allow_new_terms' => 'no',
'input_type' => 'tainacan-taxonomy-radio'
]);
}
} }
} }