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.

Customising the CMS

TreeMultiselectField with translated sitetree




10 January 2011 at 5:57am (Last edited: 10 January 2011 5:59am), Community Member, 83 Posts


i have a translated website in 4 languages:

Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');

I also have a class for Teasers, just like this:

class Teaser extends DataObject {
public static $db = array('Text' => 'HTMLText');
public static $belongs_many_many = array('Pages' => 'Page');

The Teaserclass ist also multilanguage
Object::add_extension('Teaser', 'Translatable');

In Modeladmin i am editing all 4 languages of the teasers at once (each in a tab).

When I add a new teaser in Modeladmin I want to choose on which pages this teaser is shown.

Therefore I use:

$field_Pages_de = new TreeMultiselectField ('Pages', 'show on Pages', 'SiteTree');

But now my question :)
The SiteTree always shows the Sitetree of the default Language. How can I show the 4 sitetrees for each language?