function ueditor_settings in UEditor - 百度编辑器 7
Same name and namespace in other branches
- 7.3 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 207 - Editor integration functions for ueditor.
Code
function ueditor_settings($editor, $config, $theme) {
// Settings.
$settings['editorPath'] = base_path() . $editor['library path'] . '/';
// Change the chinese language code.
if (isset($config['language']) && $config['language'] == 'zh-hans') {
$config['language'] = 'zh-cn';
}
$settings['language'] = !empty($config['language']) ? $config['language'] : 'en';
$settings['zindex'] = !empty($config['zindex']) ? $config['zindex'] : 99;
$settings['initialContent'] = !empty($config['initial_content']) ? $config['initial_content'] : '';
// Load config js.
drupal_add_js('window.UEDITOR_HOME_URL = "' . $settings['editorPath'] . '";', array(
'type' => 'inline',
'weight' => -2,
));
drupal_add_js($editor['library path'] . '/' . (!empty($config['config']) ? $config['config'] : 'ueditor.config.js'), array(
'weight' => -1,
));
// 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($editor['library path'] . '/themes/default/iframe.css');
return $settings;
}