<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
}
if (self::$_singleton === NULL) {
$sys = CRM_Extension_System::singleton();
- $cache = new CRM_Utils_Cache_SqlGroup(array(
- 'group' => 'js-strings',
- 'prefetch' => FALSE,
- ));
+ $cache = Civi::cache('js_strings');
self::$_singleton = new CRM_Core_Resources(
$sys->getMapper(),
$cache,
if (!$this->cacheCode) {
$this->resetCacheCode();
}
- $this->ajaxPopupsEnabled = (bool) CRM_Core_BAO_Setting::getItem(
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajaxPopupsEnabled', NULL, TRUE
- );
+ $this->ajaxPopupsEnabled = (bool) Civi::settings()->get('ajaxPopupsEnabled');
}
/**
// Add resources from coreResourceList
$jsWeight = -9999;
- foreach ($this->coreResourceList() as $file) {
- if (substr($file, -2) == 'js') {
+ foreach ($this->coreResourceList($region) as $item) {
+ if (is_array($item)) {
+ $this->addSetting($item);
+ }
+ elseif (substr($item, -2) == 'js') {
// Don't bother looking for ts() calls in packages, there aren't any
- $translate = (substr($file, 0, 3) == 'js/');
- $this->addScriptFile('civicrm', $file, $jsWeight++, $region, $translate);
+ $translate = (substr($item, 0, 3) == 'js/');
+ $this->addScriptFile('civicrm', $item, $jsWeight++, $region, $translate);
}
else {
- $this->addStyleFile('civicrm', $file, -100, $region);
+ $this->addStyleFile('civicrm', $item, -100, $region);
}
}
*
* Note: non-compressed versions of .min files will be used in debug mode
*
+ * @param string $region
* @return array
*/
- public function coreResourceList() {
+ public function coreResourceList($region) {
$config = CRM_Core_Config::singleton();
// Scripts needed by everyone, everywhere
"js/crm.ajax.js",
);
// add wysiwyg editor
- $editorID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id');
- $editor = CRM_Utils_Array::value($editorID,
- CRM_Core_OptionGroup::values('wysiwyg_editor', FALSE, FALSE, FALSE, NULL, 'name')
- );
+ $editor = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id');
$items[] = "js/wysiwyg/crm.wysiwyg.js";
if ($editor == "CKEditor") {
$items[] = "bower_components/ckeditor/ckeditor.js";
$items[] = "js/wysiwyg/crm.ckeditor.js";
+ $ckConfig = CRM_Admin_Page_CKEditorConfig::getConfigUrl();
+ if ($ckConfig) {
+ $items[] = array('config' => array('CKEditorCustomConfig' => $ckConfig));
+ }
}
// These scripts are only needed by back-office users
}
}
- // CMS-specific resources
- $config->userSystem->appendCoreResources($items);
+ // Allow hooks to modify this list
+ CRM_Utils_Hook::coreResourceList($items, $region);
return $items;
}