show icon on button only if icon is selected
authorKurund Jalmi <kurundjalmi@thirdsectordesign.org>
Thu, 28 Jul 2022 14:56:03 +0000 (15:56 +0100)
committerKurund Jalmi <kurundjalmi@thirdsectordesign.org>
Thu, 28 Jul 2022 14:56:03 +0000 (15:56 +0100)
ang/crmUi.js

index 075e29b0d07382cab65ae380129fa575548a96a2..dde019030d01601f13d2d7e88b80b239860a7f79 100644 (file)
             // handled in crmUiTab ctrl
             return;
           }
-          if (attrs.crmIcon.substring(0,3) == 'fa-') {
-            $(element).prepend('<i class="crm-i ' + attrs.crmIcon + '" aria-hidden="true"></i> ');
-          }
-          else {
-            $(element).prepend('<span class="icon ui-icon-' + attrs.crmIcon + '"></span> ');
+          if (attrs.crmIcon) {
+            if (attrs.crmIcon.substring(0,3) == 'fa-') {
+              $(element).prepend('<i class="crm-i ' + attrs.crmIcon + '" aria-hidden="true"></i> ');
+            }
+            else {
+              $(element).prepend('<span class="icon ui-icon-' + attrs.crmIcon + '"></span> ');
+            }
           }
+
           // Add crm-* class to non-bootstrap buttons
           if ($(element).is('button:not(.btn)')) {
             $(element).addClass('crm-button');