I disabled the option "Use the administration theme when editing or creating content" so I see everything in the default theme. But now I got a problem: The JS Drupal object is on the bottom of the page (like in a usual page all JS files should be on the bottom). But CKEditor (which I'm using) needs that object in head.

//update: I checked the scripts and found out, that ckeditor is executed on the very top of all scripts. The Drupal object on the other hand is on the bottom. I tried to reverse the array, but still the same result. Even jQuery is loaded after CKEditor.

//update2: Okay I changed the order by putting weight on the CKEditor script files and set the scope of every script file to footer, but still the Drupal object is under all files, no matter what weight I give $js['settings']. Maybe that's the wrong item?



1 Answer 1


Since the weight did not work as expected I tried to set the scope for every script to 'header' except for ckeditor files. > Did not work

Because I had no clue I tried the opposite way:

  // Set scope for every script to footer.
  foreach ($js as $index => $value) {
    $js[$index]['scope'] = 'footer';

  // Except for ckeditor files.
  $js_ckeditor_utils = &$js['sites/all/modules/ckeditor/includes/ckeditor.utils.js'];
  $js_ckeditor_utils['scope'] = 'header';
  $js_ckeditor = &$js['sites/all/libraries/ckeditor/ckeditor.js'];
  $js_ckeditor['scope'] = 'header';

This works - I don't know why, but it works.

  • Did you put this code in your theme's template.php file, in the wysiwyg module or any other place? Did you add it to any particular line or hook?
    – hachesilva
    Commented Feb 2, 2014 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.