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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

TreeMultiselectField with translated sitetree


Go to End


1420 Views

Avatar
lx

Community Member, 83 Posts

10 January 2011 at 5:57am

Edited: 10/01/2011 5:59am

Hi,

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?

thanks