From d53cfa2140d5720aab0686adb5a44b95ed210af8 Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Mon, 5 Oct 2020 16:06:58 -0300 Subject: [PATCH] transforms metadata of unknown types into text metadata #420 --- src/classes/entities/class-tainacan-metadatum.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/classes/entities/class-tainacan-metadatum.php b/src/classes/entities/class-tainacan-metadatum.php index 0b3ee15fe..9dd59bd63 100644 --- a/src/classes/entities/class-tainacan-metadatum.php +++ b/src/classes/entities/class-tainacan-metadatum.php @@ -173,13 +173,16 @@ class Metadatum extends Entity { function get_metadata_type_object(){ $class_name = $this->get_metadata_type(); - if( !class_exists( $class_name ) ){ - return null; + if( !class_exists( $class_name ) ) { + $class_name = "Tainacan\\Metadata_Types\\Text"; + if( !class_exists( $class_name ) ){ + return null; + } } - + $object_type = new $class_name(); $object_type->set_options( $this->get_mapped_property('metadata_type_options') ); - return $object_type; + return $object_type; } /**