Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
i was using WYSIWYG 6.1 and I apply the patch @27 of #689218: Improved support for CKEditor
I got a beautiful toolbar.
Now I have upgraded the module WYSIWYG to version 6.3 and I have find that the last patch, @27, was not applied.
See attached images.
I don't want to use an external module and a hook.
Can you apply that patch to ckeditor.inc file? In this way, anyone using ckeditor will have a nice toolbar.
Thanks.
function wysiwyg_ckeditor_settings($editor, $config, $theme) {
...
$settings['toolbar'] = array();
if (!empty($config['buttons'])) {
$extra_plugins = array();
// Lines added
$toolbar_groups = array(
'Source' => -1,
'Save' => 0, 'NewPage' => 0, 'Preview' => 0, 'Templates' => 0,
'Cut' => 1, 'Copy' => 1, 'Paste' => 1, 'PasteText' => 1, 'PasteFromWord' => 1, 'Print' => 1, 'SpellChecker' => 1, 'Scayt' => 1,
'Undo' => 2, 'Redo' => 2, 'Find' => 2, 'Replace' => 2, 'SelectAll' => 2, 'RemoveFormat' => 2,
'Form' => 3, 'Checkbox' => 3, 'Radio' => 3, 'TextField' => 3, 'Textarea' => 3, 'Select' => 3, 'Button' => 3, 'ImageButton' => 3, 'HiddenField' => 3,
'Bold' => 4, 'Italic' => 4, 'Underline' => 4, 'Strike' => 4, 'Subscript' => 4, 'Superscript' => 4,
'NumberedList' => 5, 'BulletedList' => 5, 'Outdent' => 5, 'Indent' => 5, 'Blockquote' => 5, 'CreateDiv' => 5,
'JustifyLeft' => 6, 'JustifyCenter' => 6, 'JustifyRight' => 6, 'JustifyBlock' => 6,
'Link' => 7, 'Unlink' => 7, 'Anchor' => 7,
'Image' => 8, 'Flash' => 8, 'Table' => 8, 'HorizontalRule' => 8, 'Smiley' => 8, 'SpecialChar' => 8, 'PageBreak' => 8,
'Styles' => 9, 'Format' => 9, 'Font' => 9, 'FontSize' => 9,
'TextColor' => 10, 'BGColor' => 10,
'Maximize' => 11, 'ShowBlocks' => 11, 'About' => 11
);
// End Lines added
$plugins = wysiwyg_get_plugins($editor['name']);
// Line added
$group = 0;
// End Line added
foreach ($config['buttons'] as $plugin => $buttons) {
foreach ($buttons as $button => $enabled) {
// Iterate separately over buttons and extensions properties.
foreach (array('buttons', 'extensions') as $type) {
// Skip unavailable plugins.
if (!isset($plugins[$plugin][$type][$button])) {
continue;
}
// Add buttons.
if ($type == 'buttons') {
// comment next line
//$settings['toolbar'][] = $button;
//Lines added
if (isset($toolbar_groups[$button])) {
if (isset($last_group) && $last_group != $toolbar_groups[$button]) {
$group++;
}
$last_group = $toolbar_groups[$button];
}
$settings['toolbar'][$group][] = $button;
// End Lines added
}
// Add external Drupal plugins to the list of extensions.
if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) {
$extra_plugins[] = $button;
}
// Add external plugins to the list of extensions.
elseif ($type == 'buttons' && empty($plugins[$plugin]['internal'])) {
$extra_plugins[] = $plugin;
}
// Add internal buttons that also need to be loaded as extension.
elseif ($type == 'buttons' && !empty($plugins[$plugin]['load'])) {
$extra_plugins[] = $plugin;
}
// Add plain extensions.
elseif ($type == 'extensions' && !empty($plugins[$plugin]['load'])) {
$extra_plugins[] = $plugin;
}
// Allow plugins to add or override global configuration settings.
if (!empty($plugins[$plugin]['options'])) {
$settings = array_merge($settings, $plugins[$plugin]['options']);
}
}
}
}
if (!empty($extra_plugins)) {
$settings['extraPlugins'] = implode(',', $extra_plugins);
}
}
// For now, all buttons are placed into one row.
// comment the next line
// $settings['toolbar'] = array($settings['toolbar']);
return $settings;
}
Comment | File | Size | Author |
---|---|---|---|
#1 | ckeditor_1054914_1.patch | 2.58 KB | eletre |
toolbar_ok.jpg | 14.43 KB | eletre | |
toolbar_bad.jpg | 12.16 KB | eletre |
Comments
Comment #1
eletre CreditAttribution: eletre commentedI tried to do a new patch from version WYSIWYG 6.x-2.3
Needs reivew.
Thanks.
Comment #2
freestone CreditAttribution: freestone commentedI changed to 6.x-2.x-dev and the tool bar is great .... I have had no issues with Dev
Comment #3
TwoDSorry, but this won't get committed.
We need a solution that can handle all editors and we're working on that in #277954: Allow to sort editor buttons.
You're welcome to help testing, reviewing and contribute code over there, we need everyone we can get for this one.
If you need a quick workaround that doesn't require Wysiwyg's or CKEditor's files to be modified, check out #829266: Fixing toolbar for the CKeditor / Using the settings hook.