X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FCustomField.php;h=ae9c4023a18b806875c4058d6ceb543267825567;hb=e34e697967b00afe2802510acd6bb91c0fc9f1a1;hp=6d69b5e18f88be806777a8e595ea860033eace62;hpb=3ad18e56058141e298552b050b631fea1af74438;p=civicrm-core.git diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 6d69b5e18f..ae9c4023a1 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1140,11 +1140,11 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @param string|array $value * @param array $field - * @param int|null $contactID + * @param int|null $entityId * * @return string */ - private static function formatDisplayValue($value, $field, $contactID = NULL) { + private static function formatDisplayValue($value, $field, $entityId = NULL) { if (self::isSerialized($field) && !is_array($value)) { $value = CRM_Utils_Array::explodePadded($value); @@ -1217,24 +1217,18 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { case 'File': // In the context of displaying a profile, show file/image - if ($contactID && $value) { - $url = self::getFileURL($contactID, $field['id'], $value); - if ($url) { - $display = $url['file_url']; + if ($value) { + if ($entityId) { + $url = self::getFileURL($entityId, $field['id']); + if ($url) { + $display = $url['file_url']; + } } - } - elseif ($value) { - // In other contexts show a paperclip icon - if (is_numeric($value)) { + else { + // In other contexts show a paperclip icon $icons = CRM_Core_BAO_File::paperIconAttachment('*', $value); $display = $icons[$value]; } - // In the context of inline view, show file/image - else { - $fileId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_File', $value, 'id', 'uri'); - $results = CRM_Core_BAO_File::getEntityFile('*', $fileId); - $display = $results[$fileId]; - } } break;