X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FRegion.php;h=63953d104b95b1ce7b86f5f2e58c275475e1316d;hb=20f57460897100cb2aea105c40c16ab16604033a;hp=bc125a42817a20171cafdd14e14ca75970fd1a82;hpb=cbd64c626562b9076d2d123e79e6fe899a547dc3;p=civicrm-core.git diff --git a/CRM/Core/Region.php b/CRM/Core/Region.php index bc125a4281..63953d104b 100644 --- a/CRM/Core/Region.php +++ b/CRM/Core/Region.php @@ -41,6 +41,9 @@ class CRM_Core_Region { */ var $_isSorted; + /** + * @param $name + */ public function __construct($name) { // Templates injected into regions should normally be file names, but sometimes inline notation is handy. require_once 'CRM/Core/Smarty/resources/String.php'; @@ -94,6 +97,8 @@ class CRM_Core_Region { * - jquery: string, Javascript code which runs inside a jQuery(function($){...}); block * - style: string, CSS code * - styleUrl: string, URL of a CSS file + * + * @return array */ public function add($snippet) { static $types = array('markup', 'template', 'callback', 'scriptUrl', 'script', 'jquery', 'style', 'styleUrl'); @@ -120,11 +125,20 @@ class CRM_Core_Region { return $snippet; } + /** + * @param $name + * @param $snippet + */ public function update($name, $snippet) { $this->_snippets[$name] = array_merge($this->_snippets[$name], $snippet); $this->_isSorted = FALSE; } + /** + * @param $name + * + * @return mixed + */ public function &get($name) { return @$this->_snippets[$name]; } @@ -175,7 +189,7 @@ class CRM_Core_Region { } break; case 'jquery': - $snippet['script'] = sprintf("cj(function(\$){\n%s\n});", $snippet['jquery']); + $snippet['script'] = sprintf("CRM.\$(function(\$) {\n%s\n});", $snippet['jquery']); // no break - continue processing as script case 'script': if (!$allowCmsOverride || !$cms->addScript($snippet['script'], $this->_name)) { @@ -201,6 +215,12 @@ class CRM_Core_Region { return $html; } + /** + * @param $a + * @param $b + * + * @return int + */ static function _cmpSnippet($a, $b) { if ($a['weight'] < $b['weight']) return -1; if ($a['weight'] > $b['weight']) return 1;