本文整理汇总了PHP中CRM_Utils_Hook::coreResourceList方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Hook::coreResourceList方法的具体用法?PHP CRM_Utils_Hook::coreResourceList怎么用?PHP CRM_Utils_Hook::coreResourceList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Hook
的用法示例。
在下文中一共展示了CRM_Utils_Hook::coreResourceList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: coreResourceList
/**
* List of core resources we add to every CiviCRM page.
*
* Note: non-compressed versions of .min files will be used in debug mode
*
* @param string $region
* @return array
*/
public function coreResourceList($region)
{
$config = CRM_Core_Config::singleton();
// Scripts needed by everyone, everywhere
// FIXME: This is too long; list needs finer-grained segmentation
$items = array("bower_components/jquery/dist/jquery.min.js", "bower_components/jquery-ui/jquery-ui.min.js", "bower_components/jquery-ui/themes/smoothness/jquery-ui.min.css", "bower_components/lodash-compat/lodash.min.js", "packages/jquery/plugins/jquery.mousewheel.min.js", "bower_components/select2/select2.min.js", "bower_components/select2/select2.min.css", "packages/jquery/plugins/jquery.tableHeader.js", "packages/jquery/plugins/jquery.form.min.js", "packages/jquery/plugins/jquery.timeentry.min.js", "packages/jquery/plugins/jquery.blockUI.min.js", "bower_components/datatables/media/js/jquery.dataTables.min.js", "bower_components/datatables/media/css/jquery.dataTables.min.css", "bower_components/jquery-validation/dist/jquery.validate.min.js", "packages/jquery/plugins/jquery.ui.datepicker.validation.min.js", "js/Common.js", "js/crm.ajax.js");
// add wysiwyg editor
$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
if (CRM_Core_Permission::check('access CiviCRM')) {
$items[] = "packages/jquery/plugins/jquery.menu.min.js";
$items[] = "css/navigation.css";
$items[] = "packages/jquery/plugins/jquery.jeditable.min.js";
$items[] = "packages/jquery/plugins/jquery.notify.min.js";
$items[] = "js/jquery/jquery.crmeditable.js";
}
// JS for multilingual installations
if (!empty($config->languageLimit) && count($config->languageLimit) > 1 && CRM_Core_Permission::check('translate CiviCRM')) {
$items[] = "js/crm.multilingual.js";
}
// Enable administrators to edit option lists in a dialog
if (CRM_Core_Permission::check('administer CiviCRM') && $this->ajaxPopupsEnabled) {
$items[] = "js/crm.optionEdit.js";
}
// Add localized jQuery UI files
if ($config->lcMessages && $config->lcMessages != 'en_US') {
// Search for i18n file in order of specificity (try fr-CA, then fr)
list($lang) = explode('_', $config->lcMessages);
$path = "bower_components/jquery-ui/ui/i18n";
foreach (array(str_replace('_', '-', $config->lcMessages), $lang) as $language) {
$localizationFile = "{$path}/datepicker-{$language}.js";
if ($this->getPath('civicrm', $localizationFile)) {
$items[] = $localizationFile;
break;
}
}
}
// Allow hooks to modify this list
CRM_Utils_Hook::coreResourceList($items, $region);
return $items;
}
示例2: coreResourceList
/**
* List of core resources we add to every CiviCRM page.
*
* @param string $region
* @return array
*/
public function coreResourceList($region)
{
$config = CRM_Core_Config::singleton();
// Use minified files for production, uncompressed in debug mode
// Note, $this->addScriptFile would automatically search for the non-minified file in debug mode but this is probably faster
$min = $config->debug ? '' : '.min';
// Scripts needed by everyone, everywhere
// FIXME: This is too long; list needs finer-grained segmentation
$items = array("bower_components/jquery/dist/jquery.min.js", "bower_components/jquery-ui/jquery-ui.min.js", "bower_components/jquery-ui/themes/smoothness/jquery-ui{$min}.css", "bower_components/lodash-compat/lodash.min.js", "packages/jquery/plugins/jquery.mousewheel{$min}.js", "bower_components/select2/select2{$min}.js", "bower_components/select2/select2{$min}.css", "packages/jquery/plugins/jquery.tableHeader.js", "packages/jquery/plugins/jquery.textarearesizer.js", "packages/jquery/plugins/jquery.form{$min}.js", "packages/jquery/plugins/jquery.timeentry{$min}.js", "packages/jquery/plugins/jquery.blockUI{$min}.js", "packages/jquery/plugins/DataTables/media/js/jquery.dataTables{$min}.js", "packages/jquery/plugins/DataTables/media/css/jquery.dataTables{$min}.css", "bower_components/jquery-validation/dist/jquery.validate{$min}.js", "packages/jquery/plugins/jquery.ui.datepicker.validation.pack.js", "js/Common.js", "js/crm.ajax.js");
// These scripts are only needed by back-office users
if (CRM_Core_Permission::check('access CiviCRM')) {
$items[] = "packages/jquery/plugins/jquery.menu{$min}.js";
$items[] = "css/navigation.css";
$items[] = "packages/jquery/plugins/jquery.jeditable{$min}.js";
$items[] = "packages/jquery/plugins/jquery.notify{$min}.js";
$items[] = "js/jquery/jquery.crmeditable.js";
}
// JS for multilingual installations
if (!empty($config->languageLimit) && count($config->languageLimit) > 1 && CRM_Core_Permission::check('translate CiviCRM')) {
$items[] = "js/crm.multilingual.js";
}
// Enable administrators to edit option lists in a dialog
if (CRM_Core_Permission::check('administer CiviCRM') && $this->ajaxPopupsEnabled) {
$items[] = "js/crm.optionEdit.js";
}
// Add localized jQuery UI files
if ($config->lcMessages && $config->lcMessages != 'en_US') {
// Search for i18n file in order of specificity (try fr-CA, then fr)
list($lang) = explode('_', $config->lcMessages);
$path = "bower_components/jquery-ui/ui/i18n";
foreach (array(str_replace('_', '-', $config->lcMessages), $lang) as $language) {
$localizationFile = "{$path}/datepicker-{$language}.js";
if ($this->getPath('civicrm', $localizationFile)) {
$items[] = $localizationFile;
break;
}
}
}
// Allow hooks to modify this list
CRM_Utils_Hook::coreResourceList($items, $region);
return $items;
}