Do not escape showHideBlocks by default
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 4 Jan 2022 22:49:42 +0000 (11:49 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 4 Jan 2022 22:51:46 +0000 (11:51 +1300)
Affects civicrm/acl?action=add&reset=1

CRM/Core/ShowHideBlocks.php
templates/CRM/common/showHide.tpl

index 1b4786987c947d969f8f3878f3104d76f22e727c..9166682c09b72dcd933b4a65917e86b285f97288 100644 (file)
@@ -81,6 +81,7 @@ class CRM_Core_ShowHideBlocks {
     }
 
     $template = CRM_Core_Smarty::singleton();
+    $template->ensureVariablesAreAssigned(['elemType']);
     $template->assign_by_ref('hideBlocks', $hide);
     $template->assign_by_ref('showBlocks', $show);
   }
index b750893acabbdb1521b8f9c191c57b94fdc06818..d30954364b7efa819b28fa6a2b49a7892a815e74 100644 (file)
@@ -9,8 +9,8 @@
 *}
 {* This included tpl hides and displays the appropriate blocks as directed by the php code which assigns showBlocks and hideBlocks arrays. *}
  <script type="text/javascript">
-    var showBlocks = new Array({$showBlocks});
-    var hideBlocks = new Array({$hideBlocks});
+    var showBlocks = new Array({$showBlocks|smarty:nodefaults});
+    var hideBlocks = new Array({$hideBlocks|smarty:nodefaults});
 
-    on_load_init_blocks( showBlocks, hideBlocks{if !empty($elemType) and $elemType EQ 'table-row'}, 'table-row'{/if} );
+    on_load_init_blocks( showBlocks, hideBlocks{if $elemType and $elemType EQ 'table-row'}, 'table-row'{/if} );
  </script>