I needed a customized toolbar for my needs and I found CKEditor does not get toolbar definitions in files another than <MODULES-PATH>/ckeditor/ckeditor.config.js.

Then I made a quick refactoring of ckeditor_load_toolbar_options() function (in ckeditor/includes/ckeditor.lib.inc). Basically, I search for the default installed theme, using list_themes() and variable_get('theme_default') calls, verifying if a ckeditor.config.js file exists in the default site theme.

In my case, I defined a "AuthoringToolbar" in sites/all/themes/zen_ninesixty/ckeditor.config.js and chosen it in mine admin/settings/ckeditor/edit/Default profile page.

CommentFileSizeAuthor
#11 ckeditor_932188_1_11.patch4.68 KBAnonymous (not verified)
#10 ckeditor_932188_5.patch6.78 KBAnonymous (not verified)
#9 ckeditor_932188_4.patch4.65 KBAnonymous (not verified)
#8 ckeditor_932188_3.patch7.61 KBAnonymous (not verified)
#7 ckeditor_932188_2.patch7.59 KBAnonymous (not verified)
#5 ckeditor_932188.patch8.24 KBAnonymous (not verified)
#4 ckeditor_932188.patch8.28 KBAnonymous (not verified)
#1 ckeditor_scan_default_theme_toolbars.patch3.2 KBAnonymous (not verified)
ckeditor.lib_.inc_.patch3.26 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Status: Active » Needs review
FileSize
3.2 KB

The last patch was generated from my Drupal root. Now, a patch from CKEditor module root, just maintaining the happiness of the maintainer and the drush make people :)

jcisio’s picture

I haven't tried this patch. But there is already an option in advanced settings that allows you to load it from theme directory.

Anonymous’s picture

Title: CKEditor does not get toolbars definitions in files another than <MODULES-PATH>/ckeditor/ckeditor.config.js » Add a field to set the ckeditor.config.js path as already in CSS and styles path
Status: Needs review » Needs work

jcisio: Let me clear something about the patch. The point I made was that, in admin/settings/ckeditor/edit/PROFILE, I am not able to select a toolbar specified in my theme's (I use a different theme in admin section) ckeditor.config.js.

Then, I created the patch to read the toolbars names from the ckeditor.config.js in the site theme path. But only now I remembered that in D6, we can use the admin theme to edit nodes. This invalidates my patch.

Looking carefully in the profile edit page, I found that we could provide a more standard way to include a custom ckeditor.config.js. I already use the CSS path and Styles path fields to customize my CKEditor.

I think a field to set the ckeditor.config.js path, like the aforementioned fields, would provide a better way to allow the CKEditor customization and also would make the configuration options more homogeneous.

Anonymous’s picture

FileSize
8.28 KB

I made another patch to demonstrate my point of view with regarding this issue.

The main problem I see nowadays, it's that the admin interface gives good ways to CSS and config.styles.js overriding and any good option for ckeditor.config.js. Explaining:

When I choose "Load ckeditor.config.js from theme path", I am presented to a wide range of posibilities. If I choose a toolbar, (DrupalFull, e.g.):

  • the CKEditor could not be presented, since I cannot guarantee that the ckeditor.config.js in the theme path will be a exact copy (or customized copy)
  • if I use different themes for admin and site, the toolbars names listed in "Toolbars" field will not contains toolbar(s) defined in themes' ckeditor.config.js
  • and finally, if a site have multiple themes and users can change them, probably they will see a textarea without the editor

However, if I choose all the related options to use the theme version (CSS, styles and ckeditor.config.js), I can have an unlimited number of specific CKEditors in a unique site.

Well, all of these is good in theory but if you try (with multiple themes, i.e.) create specific CKEditor profiles, you will never get your toolbar listed in the "Toolbar" field.

An abstract of this is that it creates too much unnecessary confusion (I'm also confused!). I preffer to create my profiles setting explicitly my CSS and Styles path (and if I need to support various themes, I just create more profiles). Then I found that setting the desired path for ckeditor.config.js would be good also.

This patch adds two new fields to the profile admin page ("Custom CKEditor configuration", "CKEditor configuration path") and removes the "Load ckeditor.config.js from theme path" field. It scans for toolbar definitions in the defined CKEditor configuration file also, then everyone can define new toolbars with different names (not restricted to Full, Basic, DrupalFull anymore).

The only drawback for this solution is that it need the CKEditor ckeditor.config.js path ("CKEditor configuration path") configured in order to scan the defined toolbars (if any).

The patch does not provide an update path (hook_update()). If this idea get approved, I can work it a little more and provide a more complete patch.

Anonymous’s picture

FileSize
8.24 KB

Ops, the patch was incorrect. Here we go again.

Anonymous’s picture

Status: Needs work » Needs review
Anonymous’s picture

Version: 6.x-1.2 » 6.x-1.6
FileSize
7.59 KB

I found my patch wasn't replacing the placeholders (%h, %t, %m). Here is an updated patch. Tested against 6.x-1.6.

Anonymous’s picture

FileSize
7.61 KB

I found that I created a bug with the latest patch. Fixed in the new attached one.

In a couple of weeks I will release a project that uses this module and the patch. I hope the reason behind it will get more clear.

Anonymous’s picture

Version: 6.x-1.6 » 6.x-1.8
FileSize
4.65 KB

Updated patch to 6.x-1.8.

This patch is used in the Drüpen distribution that ships with a JavaScript file that configures the editor instance. For distributions, using the theme directory to ship this kind of file is not effective.

Anonymous’s picture

FileSize
6.78 KB

Updated patch to 6.x-1.11 (discosider this patch, see the next comment).

Anonymous’s picture

Version: 6.x-1.8 » 6.x-1.11
FileSize
4.68 KB

The right patch file. Updated to 6.x-1.11 version of the module.

mkesicki’s picture

@eriksen.costa thank you for patch. We will check it as soon as possible.