[TYPO3-mvc] Get Domain Object with forced default language

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Dec 30 15:41:31 CET 2010


Hey again,

> I work on an extbase extension for a website with multiple languages.
> Some of the fields of my model are the same in every of the 5 languages
> and the editors don't want to have to put the same image into the 4
> translations of a record.
>
> My idea was to create a fallback mechanism. If a foreign language record
> has no image, get the image from default language.

just another idea, can't tell if it's working though. Have you tried to 
map the 'l18n_parent' (that's btw. the correct field storing the uid of 
the default language record) to a "defaultLanguage" property and 
directly access this one from within your model?

public function getImage() {
	if ($this->image === NULL) {
		return $this->getDefaultLanguage()->getImage();
	}
	return $this->image;
}

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list