Ensure deleteURL variable for ContactImage.tpl
authorBradley Taylor <hello@brad-taylor.co.uk>
Sun, 10 Apr 2022 08:09:06 +0000 (09:09 +0100)
committerBradley Taylor <hello@brad-taylor.co.uk>
Sun, 10 Apr 2022 08:09:06 +0000 (09:09 +0100)
CRM/Contact/Page/View.php
templates/CRM/Contact/Page/ContactImage.tpl

index 180a528c9cc21828894fcab6cc8cb3a1b5521692..3069497500633771de664b406648d3ac33c961ff 100644 (file)
@@ -207,6 +207,9 @@ class CRM_Contact_Page_View extends CRM_Core_Page {
     // Add links for actions menu
     self::addUrls($this, $this->_contactId);
     $this->assign('groupOrganizationUrl', $this->getGroupOrganizationUrl($contactType));
+
+    // Assign deleteURL variable, used as part of ContactImage.tpl
+    self::$_template->ensureVariablesAreAssigned(['deleteURL']);
   }
 
   /**
index a990d7dc893a5064b3a86d6715382d643195517b..2a8653525898218e5e87bdbc04211612d0a8fe8f 100644 (file)
@@ -11,7 +11,7 @@
   <div class="crm-contact_image crm-contact_image-block">
     {$imageURL}
   </div>
-  {if $action eq 0 or $action neq 1}
+  {if $action eq 0 or $action neq 1 and $deleteURL}
     <div class='crm-contact_image-block crm-contact_image crm-contact_image-delete'>{$deleteURL}</div>
   {/if}
 {/crmRegion}