feat: update get options as html on relationship #572

This commit is contained in:
vnmedeiros 2021-08-25 14:42:15 -03:00
parent 3443c979f3
commit e6a366ef38
1 changed files with 16 additions and 0 deletions

View File

@ -123,6 +123,22 @@ class Relationship extends Metadata_Type {
$readable_option_value = $option_value;
break;
case 'display_related_item_metadata':
if ( is_array($option_value) ) {
$metadata_list = [];
foreach($option_value as $metadata_id) {
if ($metadata_id == 'thumbnail') {
$metadata_list[] = __('Thumbnail', 'tainacan');
} else {
$metadata = \tainacan_metadata()->fetch( (int) $metadata_id );
if ( $metadata ) $metadata_list[] = $metadata;
}
}
$readable_option_value = implode(", ", $metadata_list);
}
break;
default:
$readable_option_value = is_string($option_value) ? $option_value : json_encode($option_value);
}