Merge pull request #435 from tainacan/feature/420

fix: transforms metadata of unknown types into text metadata
This commit is contained in:
Vinícius Nunes Medeiros 2020-10-05 16:19:05 -03:00 committed by GitHub
commit af1a080c21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -173,9 +173,12 @@ class Metadatum extends Entity {
function get_metadata_type_object(){ function get_metadata_type_object(){
$class_name = $this->get_metadata_type(); $class_name = $this->get_metadata_type();
if( !class_exists( $class_name ) ) {
$class_name = "Tainacan\\Metadata_Types\\Text";
if( !class_exists( $class_name ) ){ if( !class_exists( $class_name ) ){
return null; return null;
} }
}
$object_type = new $class_name(); $object_type = new $class_name();
$object_type->set_options( $this->get_mapped_property('metadata_type_options') ); $object_type->set_options( $this->get_mapped_property('metadata_type_options') );