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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Need help with TranslatableDataObject


Go to End


3 Posts   1497 Views

Avatar
Webdoc

Community Member, 349 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 SilverStripe Web Hosting? Look no further than Arvixe Web Hosting!

Avatar
Webdoc

Community Member, 349 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 SilverStripe Web Hosting? Look no further than Arvixe Web Hosting!

Avatar
Webdoc

Community Member, 349 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 SilverStripe Web Hosting? Look no further than Arvixe Web Hosting!