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   791 Views

Avatar
Webdoc

27 June 2013 at 8:48am (Last edited: 28 June 2013 1:58pm), Community Member, 332 Posts

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

28 June 2013 at 12:22am (Last edited: 28 June 2013 1:58pm), Community Member, 332 Posts

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

28 June 2013 at 4:05am (Last edited: 28 June 2013 1:58pm), Community Member, 332 Posts

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]!