Download & Extend

"Invalid object initializer" for Drupal.settings

Project:Vertical Tabs
Version:6.x-1.0-rc1
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:active
Issue tags:JavaScript

Issue Summary

Hi,
(premise: i googled. a lot =) I can't get my editor to show. This applies for CKeditor for 6.x-2.1 (last version of TinyMCE is unsupported), both in 6.x-dev. The error console lead me to this:

Drupal.wysiwygInit = function() {
// cut
jQuery.each(Drupal.wysiwyg.editor.init, function(editor) {
this(jQuery.extend(true, {}, Drupal.settings.wysiwyg.configs[editor]));
});
};

Drupal.settings.wysiwyg is undefined. Also in Line 148 i get the same error: Drupal.settings.wysiwyg is undefined. I'm getting serious headaches, since i'm kinda newbie to drupal; i switched to Garland, i tried more version of wysiwyg (uninstalling old versions), and so on.

Any idea? What script defines drupal.wysiwyg.settings? JS compression is disabled, by the way.

Comments

#1

Oh. I forgot this. Line 64 of edit page, in an inline script.
jQuery.extend(Drupal.settings, { "basePath": "/", "admin_menu": { "margin_top": 1 }, "content_lock": { "nid": "27" }, "wysiwyg": { "configs": { "ckeditor": { "global": { "editorBasePath": "/sites/all/libraries/ckeditor", "execMode": "" }, "format2": { "baseHref": "http://www.palmarespisa.org/", "width": "100%", "resize_minWidth": 450, "height": 420, "theme": "default", "skin": "office2003", "entities_latin": false, "entities_greek": false } } }, "disable": "Disable rich-text", "enable": "Enable rich-text", "plugins": { "format2": { "native": [ ], "drupal": [ ] } } }, "verticalTabs": { "group_details": { "name": "Dettagli notizia", "weight": 107, "callback": "group_details", "args": [ ] }, "menu": { "name": "Impostazioni del menù", "weight": 109,001, "callback": "menu", "args": [ ] }, "author": { "name": "Informazioni sull\'autore", "weight": 110,002, "callback": "author", "args": [ ] }, "revision_information": { "name": "Informazione sulla revisione", "weight": 111,003, "callback": "revision_information", "args": [ ] }, "options": { "name": "Opzioni di pubblicazione", "weight": 112,004, "callback": "options", "args": [ ] }, "comment_settings": { "name": "Impostazioni commento", "weight": 113,005, "callback": "comment_settings", "args": [ ] }, "path": { "name": "Impostazioni percorso URL", "weight": 114,006, "callback": "path", "args": [ ] } }, "views": { "ajax_path": [ "/views/ajax", "/views/ajax" ], "ajaxViews": [ { "view_name": "calendar_date", "view_display_id": "calendar_block_1", "view_args": "2010-11", "view_path": "node/27/edit", "view_base_path": "calendar-date", "view_dom_id": 1, "pager_element": 0 }, { "view_name": "calendar_date", "view_display_id": "block_1", "view_args": "", "view_path": "node/27/edit", "view_base_path": "calendar-date", "view_dom_id": 2, "pager_element": 0 } ] } });
This throws out "invalid object initializer".

#2

Project:Wysiwyg» Vertical Tabs
Version:6.x-2.x-dev» 6.x-1.0-rc1

It looks like the Vertical Tabs module is generating some invalid JSON, causing the whole Drupal.settings object to be undefined. See the lines I've marked below, removing them makes it a valid Object.

jQuery.extend(
  Drupal.settings, {
    "basePath": "/",
    "admin_menu": {
      "margin_top": 1
    },
    "content_lock": {
      "nid": "27"
    },
    "wysiwyg": {
      "configs": {
        "ckeditor": {
          "global": {
            "editorBasePath": "/sites/all/libraries/ckeditor",
            "execMode": ""
          },
          "format2": {
            "baseHref": "http://www.palmarespisa.org/",
            "width": "100%",
            "resize_minWidth": 450,
            "height": 420,
            "theme": "default",
            "skin": "office2003",
            "entities_latin": false,
            "entities_greek": false
          }
        }
      },
      "disable": "Disable rich-text",
      "enable": "Enable rich-text",
      "plugins": {
        "format2": {
          "native": [ ],
          "drupal": [ ]
        }
      }
    },
    "verticalTabs": {
      "group_details": {
        "name": "Dettagli notizia",
        "weight": 107,
        "callback": "group_details",
        "args": [ ]
      },
      "menu": {
        "name": "Impostazioni del menù",
        "weight": 109,
        001, //<----------------------------------------------------------------
        "callback": "menu",
        "args": [ ]
      },
      "author": {
        "name": "Informazioni sull\'autore",
        "weight": 110,
        002, //<----------------------------------------------------------------
        "callback": "author",
        "args": [ ]
      },
      "revision_information": {
        "name": "Informazione sulla revisione",
        "weight": 111,
        003, //<----------------------------------------------------------------
        "callback": "revision_information",
        "args": [ ]
      },
      "options": {
        "name": "Opzioni di pubblicazione",
        "weight": 112,
        004, //<----------------------------------------------------------------
        "callback": "options",
        "args": [ ]
      },
      "comment_settings": {
        "name": "Impostazioni commento",
        "weight": 113,
        005,
        "callback": "comment_settings",
        "args": [ ]
      },
      "path": { "name": "Impostazioni percorso URL",
        "weight": 114,
        006, //<----------------------------------------------------------------
        "callback": "path",
        "args": [ ]
      }
    },
    "views": {
      "ajax_path": [
       "/views/ajax",
       "/views/ajax"
      ],
      "ajaxViews": [
        {
          "view_name": "calendar_date",
          "view_display_id": "calendar_block_1",
          "view_args": "2010-11",
          "view_path": "node/27/edit",
          "view_base_path": "calendar-date",
          "view_dom_id": 1,
          "pager_element": 0
        },
        {
          "view_name": "calendar_date",
          "view_display_id": "block_1",
          "view_args": "",
          "view_path": "node/27/edit",
          "view_base_path": "calendar-date",
          "view_dom_id": 2,
          "pager_element": 0
        }
      ]
    }
  }
);

I'll move this to the Vertical Tabs issue queue. I don't know which version you're using so I'll assume the latest RC.

As for Wysiwyg, it's latest -devs do support latest TinyMCE. I think you may be using an older -dev version as the code above says the office2003 skin is used for ckeditor, caused by a bug fixed in the latest -dev: #737318: ckeditor skins problem.

#3

Title:Editor not showing up, error in wysiwyg.js» "Invalid object initializer" for Drupal.settings

Better title.

#4

Hey folks;

I've identified and fixed the issue in this thread: http://drupal.org/node/801112

The root I believe is caused by localization settings on the server and is probably tied to the use of number_format() deep within the bowels of the form API. As a solution I altered the weights in Vertical Tabs to simply not use a decimal point.

#5

Core doesn't use number_format() for FAPI weights at all. You've got something maliciously changing setlocale() and altering all PHP variables that are numbers. That will cause several problems throughout your entire install.

#6

Dave is correct, something is being bad and altering the number formatting for the site. This will cause issues all over.

The module here (http://drupal.org/node/801112#comment-3835900) attempts to fix this (and does in my cases) by resetting the locale LC_NUMERIC format in several places.

#7

Soyarma,
Your module don't solve the problem,
It persist
This module in the commentary above didn't work for me.

#8

My error was caused by vertical tabs,
And i fixed with this patch
http://drupal.org/node/801112#comment-3826004