Skip to content
Snippets Groups Projects
Commit 8cb324cc authored by colemanw's avatar colemanw
Browse files

Fix inconsistent ordering of header elements CRM-12339

In D6 & D7 our header region seems to always render before drupal's scripts and styles,
whereas Joomla was the opposite. To fix this I have rolled-back the use of JFactory to add scripts,
and weighted our settings region so it will always be the first thing in the header.
parent d937dbcd
No related branches found
No related tags found
No related merge requests found
......@@ -205,7 +205,8 @@ class CRM_Core_Resources {
CRM_Core_Region::instance('html-header')->add(array(
'callback' => function(&$snippet, &$html) use ($resources) {
$html .= "\n" . $resources->renderSetting();
}
},
'weight' => -100000,
));
$this->addedSettings = TRUE;
}
......@@ -261,7 +262,7 @@ class CRM_Core_Resources {
* @return string
*/
public function renderSetting() {
$js = 'var CRM = cj.extend(true, ' . json_encode($this->getSettings()) . ', CRM || {});';
$js = 'var CRM = ' . json_encode($this->getSettings()) . ';';
return sprintf("<script type=\"text/javascript\">\n%s\n</script>\n", $js);
}
......
......@@ -261,11 +261,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
* @access public
*/
public function addScriptUrl($url, $region) {
if ($region == 'html-header') {
$document = JFactory::getDocument();
$document->addScript($url);
return TRUE;
}
return FALSE;
}
......@@ -282,11 +277,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
* @access public
*/
public function addScript($code, $region) {
if ($region == 'html-header') {
$document = JFactory::getDocument();
$document->addScriptDeclaration($code);
return TRUE;
}
return FALSE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment