Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions

when Translatable enabled, JS error in CMS


2 Posts   995 Views


22 September 2009 at 1:56am Community Member, 68 Posts

when i enable Translatable in _config.php, and login to admin, a JS error shows up when i select any page in sitetree of CMS.

Im trying to add translations to all pages, and then add a language switcher to the theme and im stuck at the very beginning.

I would really appreciate if somebody could give me a hand as i want to allow my client start adding tri-lingual content to his website (polish ,english, german)


Below is the error:

ERROR [Notice]: Object of class Panel could not be converted to int
IN POST /ztm/admin/getitem?ID=15&locale=pl_PL&ajax=1
Line 22 in /home/2eur/www/ztm/sapphire/forms/LanguageDropdownField.php

13:     * @param string $title
14:     * @param array $excludeLocales List of locales that won't be included
15:     * @param string $translatingClass Name of the class with translated instances where to look for
used languages
16:     * @param string $list Indicates the source language list. Can be either Common-English,
Common-Native, Locale-English, Locale-Native
17:     */
18:    function __construct($name, $title, $excludeLocales = array(), $translatingClass = 'SiteTree',
$list = 'Common-English', $instance = null) {
19:       $usedLocalesWithTitle = Translatable::get_existing_content_languages($translatingClass);
20:       $usedLocalesWithTitle = array_diff_key($usedLocalesWithTitle, $excludeLocales);
* 22:       if('Common-English' == $list) $allLocalesWithTitle = i18n::get_common_languages();
23:       else if('Common-Native' == $list) $allLocalesWithTitle = i18n::get_common_languages(true);
24:       else if('Locale-English' == $list) $allLocalesWithTitle = i18n::get_common_locales();
25:       else if('Locale-Native' == $list) $allLocalesWithTitle = i18n::get_common_locales(true);
26:       else $allLocalesWithTitle = i18n::get_locale_list();
28:       if(isset($allLocales[Translatable::default_locale()]))

<ul>LanguageDropdownField->__construct(NewTransLang,Nowy język,Array,SiteTree,Object id #50)
line 879 of Translatable.php

Translatable->updateCMSFields(Object id #47,,,,,,)
line 741 of Object.php

Object->extend(updateCMSFields,Object id #47)
line 1328 of SiteTree.php

SiteTree->getCMSFields(Object id #17)
line 390 of CMSMain.php

line 925 of LeftAndMain.php

line 380 of LeftAndMain.php

LeftAndMain->getitem(Object id #15)
line 162 of Controller.php

Controller->handleAction(Object id #15)
line 129 of RequestHandler.php

RequestHandler->handleRequest(Object id #15)
line 122 of Controller.php

Controller->handleRequest(Object id #15)
line 277 of Director.php

Director::handleRequest(Object id #15,Session)
line 121 of Director.php

line 118 of main.php



26 September 2009 at 12:26am Community Member, 68 Posts

on irc simon helped me to provide a temporary solution to get rid of this JS error.

Steps required:
- edit sapphire/core/model/Translatable.php
- in line 873, after 'SiteTree', add 'Common-Native',

with quote and comma being imporant.

This should make the error dissapear.