Merge pull request #12141 from seamuslee001/file_perms_fix
[civicrm-core.git] / CRM / Core / Region.php
index 61feec9ba146cf2ac135d73854426e4d03288efb..77b3e6065b2a65083aba5e715914d7f7ad606062 100644 (file)
@@ -122,6 +122,7 @@ class CRM_Core_Region {
     if (!isset($snippet['name'])) {
       $snippet['name'] = count($this->_snippets);
     }
+
     $this->_snippets[$snippet['name']] = $snippet;
     $this->_isSorted = FALSE;
     return $snippet;
@@ -137,12 +138,14 @@ class CRM_Core_Region {
   }
 
   /**
+   * Get snippet.
+   *
    * @param string $name
    *
    * @return mixed
    */
-  public function &get($name) {
-    return @$this->_snippets[$name];
+  public function get($name) {
+    return !empty($this->_snippets[$name]) ? $this->_snippets[$name] : NULL;
   }
 
   /**
@@ -170,29 +173,18 @@ 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':
-          if ($placement == 'before') {
-            $html = $snippet['markup'] . $html;
-          }
-          else {
-            $html .= $snippet['markup'];
-          }
+          $html .= $snippet['markup'];
           break;
 
         case 'template':
           $tmp = $smarty->get_template_vars('snippet');
           $smarty->assign('snippet', $snippet);
-          if ($placement == 'before') {
-            $html = $smarty->fetch($snippet['template']) . $html;
-          }
-          else {
-            $html .= $smarty->fetch($snippet['template']);
-          }
+          $html .= $smarty->fetch($snippet['template']);
           $smarty->assign('snippet', $tmp);
           break;