You are here

function wysiwyg_js_alter in Wysiwyg 6.2

Implementation of hook_js_alter().

Applies overrides to CTools' scripts command or it will execute editor scripts twice, causing instances/state to be lost (YUI Editor).

Needs the jsalter module for this to be called in D6.

File

./wysiwyg.module, line 267
Integrates client-side editors with Drupal.

Code

function wysiwyg_js_alter(&$scripts, $scope, &$queryString) {
  if (module_exists('ctools')) {
    $path = drupal_get_path('module', 'ctools') . '/js/ajax-responder.js';
    if (isset($scripts['module'][$path])) {

      // Add this directly to the scripts.
      $scripts['module'][drupal_get_path('module', 'wysiwyg') . '/override-ctools-ajax.js'] = array(
        'cache' => TRUE,
        'defer' => FALSE,
        'preprocess' => TRUE,
      );

      // Modules like jquery_update call drupal_get_js() again after this.
      drupal_add_js(drupal_get_path('module', 'wysiwyg') . '/override-ctools-ajax.js');
    }
  }
}