X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FCustomField.php;h=ae9c4023a18b806875c4058d6ceb543267825567;hb=e34e697967b00afe2802510acd6bb91c0fc9f1a1;hp=1494bca00586530bd12d1207a199fc7471f59d00;hpb=1e5e9714ae0fdad3ea5521b2690c6bdedf086ddb;p=civicrm-core.git diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 1494bca005..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,16 +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']; + } + } + else { + // In other contexts show a paperclip icon + $icons = CRM_Core_BAO_File::paperIconAttachment('*', $value); + $display = $icons[$value]; } - } - // In other contexts show a paperclip icon - elseif ($value) { - $icons = CRM_Core_BAO_File::paperIconAttachment('*', $value); - $display = $icons[$value]; } break;