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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Need help with TranslatableDataObject


Reply


3 Posts   883 Views

Avatar
Webdoc

Community Member, 334 Posts

27 June 2013 at 8:48am

Edited: 28/06/2013 1:58pm

added to config line:

TranslatableDataObject::register('Referents', array(
'Objektinimi',
));


Im using ss2.4.10

-------------------------------------------------------------------------------------------------------------
Arvixe Web Hosting / SilverStripe Community Liaison | Looking for quality [url=http://www.arvixe.com/preloaded_silverstripe_hosting/]SilverStripe Web Hosting[/url]? Look no further than [url=http://www.arvixe.com/]Arvixe Web Hosting[/url]!

Avatar
Webdoc

Community Member, 334 Posts

28 June 2013 at 12:22am

Edited: 28/06/2013 1:58pm

tried with no luck

<?php
class Referents extends DataObject
{
   static $db = array (
   'Objektinimi' => 'Text',
   'Aasta' => 'Text',
   'ObjektiKat' => "Enum('Pooleli,Valmis')",
   );
   static $has_one = array (
   'Reflist' => 'Reflist',
   'Photo' => 'Image'
   );
   static $default_sort = 'Aasta DESC';
   
   public function getCMSFields_forPopup()
   {
   $fields = new FieldSet(
      new TextField('Aasta', 'Aasta'),
      new TextField('Objektinimi', 'Objekti nimi'),
      new DropdownField('ObjektiKat','ObjektiKat',singleton('Referents')->dbObject('ObjektiKat')->enumValues()),
      new ImageField('Photo', 'Objekti pilt')
      );
//replace the field with translation;
$myfield = $this->getTranslationFields("Objektinimi");
$fields->replaceField('Objektinimi',$myfield);
return $fields;
   }
}
?>


-------------------------------------------------------------------------------------------------------------
Arvixe Web Hosting / SilverStripe Community Liaison | Looking for quality [url=http://www.arvixe.com/preloaded_silverstripe_hosting/]SilverStripe Web Hosting[/url]? Look no further than [url=http://www.arvixe.com/]Arvixe Web Hosting[/url]!

Avatar
Webdoc

Community Member, 334 Posts

28 June 2013 at 4:05am

Edited: 28/06/2013 1:58pm

gives error in cms:

ERROR [User Error]: Uncaught Exception: Object->__call(): the method 'gettranslationfields' does not exist on 'Referents'

-------------------------------------------------------------------------------------------------------------
Arvixe Web Hosting / SilverStripe Community Liaison | Looking for quality [url=http://www.arvixe.com/preloaded_silverstripe_hosting/]SilverStripe Web Hosting[/url]? Look no further than [url=http://www.arvixe.com/]Arvixe Web Hosting[/url]!