It would be nice if we can have alter() hooks to alter the settings of ckeditor. E.g. to change the ckeditor.config.js path to handle custom changes better (don't hack/change the contrib code).

The main problem for this feature is related to this issue #1056106: Updating ckeditor overwrites changed ckeditor.config.js

With a general settings alter hook, other modules have much more possibilities to interace with ckeditor and/or ckeditor module without to "hack" the code.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cbeier’s picture

I implemented the alter() hook and added documentation for the hook in ckeditor.api.php.

wwalc’s picture

Status: Active » Needs review
wwalc’s picture

If anyone tried it, please add here a comment.

BarisW’s picture

Status: Needs review » Reviewed & tested by the community

Patch works as expected, thanks!

I've used it to override the toolbar without having to override an existing feature (from Drupal Commons).

<?php
/**
 * Implements hook_ckeditor_settings_alter().
 */
function MYMODULE_ckeditor_settings_alter(&$settings) {
  // Change the buttons in the wysiwyg interface without overriding the
  // Commons WYSIWYG feature.
  if (!empty($settings['loadPlugins'])) {
    $settings['toolbar'] = "[
      ['Format'],
      ['Bold','Italic','Strike'],
      ['NumberedList','BulletedList','Indent','Outdent','Blockquote'],
      ['Link','Unlink','Image','RemoveFormat']
    ]";
  }
}
?>
jcisio’s picture

Status: Reviewed & tested by the community » Fixed

Committed #1. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pfrenssen’s picture

Created a followup issue to allow modules to alter the default settings in addition to the actual settings: #2013657: Allow other modules to alter the default settings.

douggreen’s picture

FileSize
493 bytes

It would be nice to have the profile name with the settings, but I'm not sure if we should alter this.