diff --git a/src/views/admin/components/metadata-types/compound/class-tainacan-compound.php b/src/views/admin/components/metadata-types/compound/class-tainacan-compound.php index 1669efce5..a6962428c 100644 --- a/src/views/admin/components/metadata-types/compound/class-tainacan-compound.php +++ b/src/views/admin/components/metadata-types/compound/class-tainacan-compound.php @@ -196,10 +196,11 @@ class Compound extends Metadata_Type { foreach ( $compound_element as $meta_id => $meta ) { $index = array_search( $meta_id, array_column( $order, 'id' ) ); if ( $meta instanceof Item_Metadata_Entity && $meta->get_value_as_html() != '' ) { + $html = $this->get_meta_html($meta); if ( $index !== false ) { - $metadata_value[$index] = '

' . $meta->get_value_as_html() . "

"; + $metadata_value[$index] = $html; } else { - $metadata_value_not_ordinate[] = '

' . $meta->get_value_as_html() . "

"; + $metadata_value_not_ordinate[] = $html; } } } @@ -213,18 +214,27 @@ class Compound extends Metadata_Type { foreach ( $value as $meta_id => $meta ) { $index = array_search( $meta_id, array_column( $order, 'id' ) ); if ( $meta instanceof Item_Metadata_Entity && $meta->get_value_as_html() != '' ) { + $html = $this->get_meta_html($meta); if ( $index !== false ) { - $metadata_value[intval($index)] = '

' . $meta->get_value_as_html() . "

"; + $metadata_value[intval($index)] = $html; } else { - $metadata_value_not_ordinate[] = '

' . $meta->get_value_as_html() . "

"; + $metadata_value_not_ordinate[] = $html; } } - } - $return = '
' . implode("\n", array_merge($metadata_value, $metadata_value_not_ordinate)) . "
\n"; + } + $return = '
' . implode("\n", array_merge($metadata_value, $metadata_value_not_ordinate)) . "
\n"; } return $return; - + } + + private function get_meta_html(Item_Metadata_Entity $meta) { + $html = ''; + if ($meta instanceof Item_Metadata_Entity && !empty($meta->get_value_as_html())) { + $html = '

' . $meta->get_value_as_html() . "

"; + } + + return $html; } } \ No newline at end of file diff --git a/src/views/admin/components/metadata-types/date/class-tainacan-date.php b/src/views/admin/components/metadata-types/date/class-tainacan-date.php index 45abfa299..a842c27f8 100644 --- a/src/views/admin/components/metadata-types/date/class-tainacan-date.php +++ b/src/views/admin/components/metadata-types/date/class-tainacan-date.php @@ -77,9 +77,9 @@ class Date extends Metadata_Type { $return .= $separator; } } else { - $return = $this->format_date_value($value); } + return $return; } diff --git a/src/views/admin/components/metadata-types/taxonomy/class-tainacan-taxonomy.php b/src/views/admin/components/metadata-types/taxonomy/class-tainacan-taxonomy.php index e46988e1d..27ad6fd1c 100644 --- a/src/views/admin/components/metadata-types/taxonomy/class-tainacan-taxonomy.php +++ b/src/views/admin/components/metadata-types/taxonomy/class-tainacan-taxonomy.php @@ -338,7 +338,6 @@ class Taxonomy extends Metadata_Type { $return = ''; if ( $item_metadata->is_multiple() ) { - $count = 1; $total = sizeof($value); $prefix = $item_metadata->get_multivalue_prefix(); @@ -346,7 +345,6 @@ class Taxonomy extends Metadata_Type { $separator = $item_metadata->get_multivalue_separator(); foreach ( $value as $term ) { - $count ++; if ( is_integer($term) ) { @@ -355,29 +353,22 @@ class Taxonomy extends Metadata_Type { if ( $term instanceof \Tainacan\Entities\Term ) { $return .= $prefix; - $return .= $this->get_term_hierarchy_html($term); - $return .= $suffix; if ( $count <= $total ) { $return .= $separator; } - } - } } else { - if ( $value instanceof \Tainacan\Entities\Term ) { $return .= $this->get_term_hierarchy_html($value); } - } return $return; - } private function get_term_hierarchy_html( \Tainacan\Entities\Term $term ) {