Jump to:

10842 Posts in 2513 Topics by 1792 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: 367 Views
  • apiening
    Avatar
    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.

    cheers

    andy

  • banksy
    Avatar
    Community Member
    3 Posts

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

    Bump.

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

    Cheers
    Jeremy

    367 Views
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.