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.

All other Modules /

Discuss all other Modules here.

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

TRANSLATABLE: getTranslation fails after changing pagetype (SS3)


Go to End
Reply


2 Posts   749 Views

Avatar
apiening

Community Member, 60 Posts

4 January 2013 at 2:08am

hi forum,

when i change a pagetype (e.g. from Page to HomePage) the existing translations of that page keep the original classname and the cms pagetype dopdown for the translations is readonly. $page->getTranslation($locale) returns null although a translation exists. that is because the corresponding query filters by classname: ("SiteTree"."ClassName" IN ('HomePage')).

my question is: how is this supposed to work? does a valid translation have to have the same classname and all translations should have their classnames changed like i assume after inspecting Translatable::onBeforeWrite()? or should it be possible to have translations with different classnames wich should be returned by Translatable::getTranslation()?

class Page_Controller extends ContentController {

	public function Homepage($locale) {
		if(empty($locale)) $locale = Translatable::get_current_locale();
		$homepage = $this->Page('home');
		$_REQUEST['showqueries'] = 1;
		if($homepage->Locale != $locale) $homepage = $homepage->getTranslation($locale);
		$_REQUEST['showqueries'] = null;
		return $homepage;
	}
}

anyway, looks like this is broken. or am i missing something.

i'm using ss3.1.0.beta1 with the most recent version of translatable.

cheers

andy

Avatar
banksy

Community Member, 3 Posts

13 March 2013 at 7:30pm

Bump.

Andy any progress on this? I'm getting the same thing.

Cheers
Jeremy