function ueditor_settings in UEditor - 百度编辑器 7.3
Same name and namespace in other branches
- 7 editors/ueditor.inc \ueditor_settings()
- 7.2 editors/ueditor.inc \ueditor_settings()
Return runtime editor settings for a given wysiwyg profile.
Parameters
array $editor: A processed hook_editor() array of editor properties.
array $config: An array containing wysiwyg editor profile settings.
string $theme: The name of a theme/GUI/skin to use.
Return value
array A settings array to be populated in Drupal.settings.wysiwyg.configs.{editor}
1 string reference to 'ueditor_settings'
- ueditor_ueditor_editor in editors/
ueditor.inc - Plugin implementation of hook_editor().
File
- editors/
ueditor.inc, line 295 - Editor integration functions for ueditor.
Code
function ueditor_settings($editor, $config, $theme) {
// Settings.
if (!isset($config['allowdivtop']) || !isset($config['auto_height']) || !isset($config['auto_float']) || !isset($config['initialFrameHeight']) || !isset($config['show_elementpath']) || !isset($config['show_wordcount'])) {
$settings = ueditor_config_default();
}
else {
$settings = $config;
if ($config['allowdivtop'] == 1) {
$settings['allowdivtop'] = true;
}
else {
$settings['allowdivtop'] = false;
}
if ($config['auto_height'] == 1) {
$settings['auto_height'] = true;
}
else {
$settings['auto_height'] = false;
}
if ($config['auto_float'] == 1) {
$settings['auto_float'] = true;
}
else {
$settings['auto_float'] = false;
}
if ($config['show_elementpath'] == 1) {
$settings['show_elementpath'] = true;
}
else {
$settings['show_elementpath'] = false;
}
if ($config['show_wordcount'] == 1) {
$settings['show_wordcount'] = true;
}
else {
$settings['show_wordcount'] = false;
}
}
global $base_url;
$settings['editorPath'] = $base_url . '/' . $editor['library path'] . '/';
// Change the chinese language code.
if (isset($settings['language']) && $settings['language'] == 'zh-hans') {
$settings['language'] = 'zh-cn';
}
$settings['toolbars'] = !empty($config['toolbars']) ? array(
explode(',', $config['toolbars']),
) : $settings['toolbars'];
if ((bool) variable_get('clean_url', 0)) {
$settings['serverUrl'] = base_path() . 'ueditor/controller';
}
else {
$settings['serverUrl'] = base_path() . '?q=ueditor/controller';
}
if (variable_get('ueditor_enable_paging', 0) == 1 && module_exists('paging')) {
$settings['pageBreakTag'] = htmlentities(variable_get('paging_separator', '<!--pagebreak-->'));
}
// Load config js.
drupal_add_js($editor['library path'] . '/ueditor.config.js', array(
'weight' => -1,
'preprocess' => FALSE,
));
// Theme.
// Ueditor temporarily does not support multiple themes,
// Can customize CSS overwrite.
drupal_add_css($editor['library path'] . '/themes/default/css/ueditor.css');
drupal_add_css(drupal_get_path('module', 'ueditor') . '/css/ueditor-compatible.css');
drupal_add_css($editor['library path'] . '/themes/default/iframe.css');
// If enable kityformula support, load kityformula js.
if (variable_get('ueditor_enable_formula_editor', 0)) {
drupal_add_js($editor['library path'] . '/kityformula-plugin/addKityFormulaDialog.js', array(
'weight' => 5,
'preprocess' => FALSE,
));
drupal_add_js($editor['library path'] . '/kityformula-plugin/getKfContent.js', array(
'weight' => 5,
'preprocess' => FALSE,
));
drupal_add_js($editor['library path'] . '/kityformula-plugin/defaultFilterFix.js', array(
'weight' => 5,
'preprocess' => FALSE,
));
}
return $settings;
}