function wysiwyg_whizzywig_settings in Wysiwyg 7.2
Same name and namespace in other branches
- 5.2 editors/whizzywig.inc \wysiwyg_whizzywig_settings()
- 5 editors/whizzywig.inc \wysiwyg_whizzywig_settings()
- 6.2 editors/whizzywig.inc \wysiwyg_whizzywig_settings()
- 6 editors/whizzywig.inc \wysiwyg_whizzywig_settings()
Return runtime editor settings for a given wysiwyg profile.
Parameters
$editor: A processed hook_editor() array of editor properties.
$config: An array containing wysiwyg editor profile settings.
$theme: The name of a theme/GUI/skin to use.
Return value
A settings array to be populated in Drupal.settings.wysiwyg.configs.{editor}
1 string reference to 'wysiwyg_whizzywig_settings'
- wysiwyg_whizzywig_editor in editors/
whizzywig.inc - Plugin implementation of hook_editor().
File
- editors/
whizzywig.inc, line 96 - Editor integration functions for Whizzywig.
Code
function wysiwyg_whizzywig_settings($editor, $config, $theme) {
$settings = array();
// Add path to button images, if available.
if (is_dir($editor['library path'] . '/btn')) {
$settings['buttonPath'] = base_path() . $editor['library path'] . '/btn/';
}
if (file_exists($editor['library path'] . '/WhizzywigToolbar.png')) {
$settings['toolbarImagePath'] = base_path() . $editor['library path'] . '/WhizzywigToolbar.png';
}
elseif (file_exists($editor['library path'] . '/icons.png')) {
$settings['toolbarImagePath'] = base_path() . $editor['library path'] . '/icons.png';
}
// Add configured buttons or all available.
$settings['buttons'] = array();
if (!empty($config['buttons'])) {
$buttons = array();
foreach ($config['buttons'] as $plugin) {
$buttons = array_merge($buttons, $plugin);
}
$settings['buttons'] = implode(' ', array_keys($buttons));
}
// Add editor content stylesheet.
// @todo CSS settings are currently not used.
if (isset($config['css_setting'])) {
if ($config['css_setting'] == 'theme') {
$css = drupal_get_path('theme', variable_get('theme_default', NULL)) . '/style.css';
if (file_exists($css)) {
$settings['externalCSS'] = base_path() . $css;
}
}
elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) {
$settings['externalCSS'] = strtr($config['css_path'], array(
'%b' => base_path(),
'%t' => drupal_get_path('theme', variable_get('theme_default', NULL)),
'%q' => variable_get('css_js_query_string', ''),
));
}
}
return $settings;
}