fix: update item for control metadatum

This commit is contained in:
vnmedeiros 2021-07-23 09:05:48 -03:00
parent 1e965f0187
commit 33fdb5998e
1 changed files with 23 additions and 2 deletions

View File

@ -59,7 +59,7 @@ class MetadataTypeControlHelper {
break;
default:
// What the hell am I doing here?
$update_item_metadatum->set_value( $update_item_metadatum->get_value() );
break;
}
@ -143,7 +143,28 @@ class Control extends Metadata_Type {
public function get_value_as_html(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
$value = $item_metadata->get_value();
$control_metadatum = $this->get_option('control_metadatum');
return $this->get_control_metadatum_value($value, $control_metadatum, 'html');
if (in_array($control_metadatum, ['document_type', 'collection_id', 'has_thumbnail']))
return $this->get_control_metadatum_value($value, $control_metadatum, 'html');
$return = '';
if ( $item_metadata->is_multiple() ) {
$total = sizeof($value);
$count = 0;
$prefix = $item_metadata->get_multivalue_prefix();
$suffix = $item_metadata->get_multivalue_suffix();
$separator = $item_metadata->get_multivalue_separator();
foreach ($value as $v) {
$return .= $prefix;
$return .= (string) $v;
$return .= $suffix;
$count ++;
if ($count < $total)
$return .= $separator;
}
} else {
$return = (string) $value;
}
return $return;
}
/**