add price-set region & placement option
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 15 Jun 2015 02:24:50 +0000 (14:24 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 15 Jun 2015 08:09:27 +0000 (20:09 +1200)
CRM/Core/Region.php
templates/CRM/Price/Form/PriceSet.tpl

index 7868cee23813384dcd91f33f40ccb39a2d88c6d8..61feec9ba146cf2ac135d73854426e4d03288efb 100644 (file)
@@ -170,18 +170,29 @@ class CRM_Core_Region {
     $smarty = CRM_Core_Smarty::singleton();
     $html = '';
     foreach ($this->_snippets as $snippet) {
+      $placement = empty($snippet['placement']) ? 'after' : $snippet['placement'];
       if ($snippet['disabled']) {
         continue;
       }
       switch ($snippet['type']) {
         case 'markup':
-          $html .= $snippet['markup'];
+          if ($placement == 'before') {
+            $html = $snippet['markup'] . $html;
+          }
+          else {
+            $html .= $snippet['markup'];
+          }
           break;
 
         case 'template':
           $tmp = $smarty->get_template_vars('snippet');
           $smarty->assign('snippet', $snippet);
-          $html .= $smarty->fetch($snippet['template']);
+          if ($placement == 'before') {
+            $html = $smarty->fetch($snippet['template']) . $html;
+          }
+          else {
+            $html .= $smarty->fetch($snippet['template']);
+          }
           $smarty->assign('snippet', $tmp);
           break;
 
index 52ad50410bbdda21e28417621824ca06c7320a16..9ee1f2b0fc3ba322d2052dc5f3e5dfeb95393a28 100644 (file)
@@ -23,6 +23,7 @@
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
+{crmRegion name="price-set-1"}
 <div id="priceset" class="crm-section price_set-section">
     {if $priceSet.help_pre}
         <div class="messages help">{$priceSet.help_pre}</div>
     {include file="CRM/Price/Form/Calculate.tpl"}
 {/if}
 </div>
+{/crmRegion}