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.

All other Modules /

Discuss all other Modules here.

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

Translateable dataobject


Reply


217 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