Jump to:

11003 Posts in 2735 Topics by 1824 members

All other Modules

SilverStripe Forums » All other Modules » TRANSLATABLE: getTranslation fails after changing pagetype (SS3)

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 453 Views
  • apiening
    Community Member
    55 Posts

    TRANSLATABLE: getTranslation fails after changing pagetype (SS3) Link to this post

    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.



  • banksy
    Community Member
    3 Posts

    Re: TRANSLATABLE: getTranslation fails after changing pagetype (SS3) Link to this post


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


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.