I'm trying to set settings in a custom module using hook_ckeditor_settings_alter() but the hook isn't being called on `admin/config/content/ckeditor/edit/Advanced` or `admin/config/content/ckeditor/edit/Basic` at all, so what shows in the UI is completely wrong. I'm not really sure what I expected since that's usually what _alter hooks usually do...

Better question: What's the recommended way to replace ckeditor.config.js, including all the defaults that are provided for the settings form? (and please don't say to put that in the theme...)

I had found an example somewhere that recommended the following approach but I'm unable to replace the toolbars this way.

function example_ckeditor_settings_alter(&$settings, $conf) {
  // Change the ckeditor config path.
  $settings['customConfig'] = drupal_get_path('module', 'example') . '/ckeditor.config.js';
}

Comments

jenlampton created an issue. See original summary.

jenlampton’s picture

Issue summary: View changes
jenlampton’s picture

Issue summary: View changes
morsok’s picture

Component: User interface » Code

From what i've seen so far, I think the hook is simply never called !

vinmassaro’s picture

@jenlampton: it appears that the hook is called when the CKEditor settings are compiled, which is when the editor is loaded. This doesn't happen when loading a configuration page for the module. I implemented hook_ckeditor_settings_alter() in a custom module and added dpm($settings); to it. If I load a node edit or create page and then refresh it again, I can see the $settings array, so this hook does get called properly.

Overriding the config as documented should work.