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.

All other Modules /

Discuss all other Modules here.

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

Translateable dataobject


Go to End


749 Views

Avatar
Stief

Community Member, 1 Post

21 January 2014 at 6:15am

I'm using silverstripe version 3.1

I tried to add to each DataObject a translation. For that I've used the following module: https://github.com/bummzack/translatable-dataobject

I would like to have a modeladmin which uses a dataobject in 3 languages. (German, French and English - 3 Tabs)

private static $db = array(
'Title' => 'Varchar(200)'
);

public function getCMSFields() {

$fields = new FieldList();
$fields->add($this->getTranslatableTabSet());
$fields->removeByName("URLSegment");
return $fields;
}

How can I add

new TextField('Title', 'Titel *', '', 20)

in order to be able to define for example the limit of characters of 20?

This example didn't work for me. Only a blank site is shown in the CMS:

public function getCMSFields() {

$fields = new FieldList(
new TextField('Title', 'Titel *', '', 20)
);
$fields->add($this->getTranslatableTabSet());
$fields->removeByName("URLSegment");
return $fields;
}

Any ideas what I did wrong? Thank you