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


Go to End
Reply


3 Posts   918 Views

Avatar
Webdoc

Community Member, 336 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, 336 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, 336 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!