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, Ed, biapar, Willr, Ingo, swaiba

Making DataObjects stay in new translations

Go to End

2 Posts   888 Views


Community Member, 65 Posts

23 October 2010 at 2:54am

I have added GalleryImageResources and HighlightImageResources to every of my pages. Both extend DataObject. But if I add a new translation to the page, the DataObjects are not inherited from the standard-language version of the page. Can I implement a function to do so?


Community Member, 4 Posts

28 October 2010 at 8:51pm

Hi Oleze,

I'm fairly new to SilverStripe but this thread helped me out trying to solve a similar problem to the one you described:

Seems like you need to implement a function something like this on your Page.php

public function TranslatedMediaObjects() {
	$Data = $this -> MediaObjects();
	// Get dataobjects from default language page
	if ($this->Locale != Translatable::default_locale()) {
		$Data = $this->getTranslation(Translatable::default_locale()) -> MediaObjects();
	return $Data;

Then include $TranslatedMediaObjects in your template.