CRM-16076 - Restore file/image behavior in profiles
authorColeman Watts <coleman@civicrm.org>
Fri, 13 Mar 2015 01:57:53 +0000 (21:57 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 13 Mar 2015 01:57:53 +0000 (21:57 -0400)
CRM/Core/BAO/CustomField.php

index 5ea64fb31c694b7509484656e0e4360b3e4d41fb..d46ffb013987d3985409d46acfc574b256cd855f 100644 (file)
@@ -1286,7 +1286,15 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
         break;
 
       case 'File':
-        if ($value) {
+        // In the context of displaying a profile, show file/image
+        if ($contactID) {
+          $url = self::getFileURL($contactID, $fieldID, $value);
+          if ($url) {
+            $display = $url['file_url'];
+          }
+        }
+        // In other contexts show a paperclip icon
+        elseif ($value) {
           $icons = CRM_Core_BAO_File::paperIconAttachment('*', $value);
           $display = $icons[$value];
         }