Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Translatable and 3.1 - publishall not working - hack

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 253 Views
  • mikg
    Avatar
    Community Member
    1 Post

    Translatable and 3.1 - publishall not working - hack Link to this post

    This is fixed on github now. Ingo committed a broader solution to the problem the day this was posted. Kudo's for the quick reaction!

    Hi there,

    When using the Translatable module (master branch from github dated 14/04/2013) the publishall function (http://<yoursite>/admin/pages/publishall) (http://api.silverstripe.org/3.0/source-class-CMSMain.html#1188-1240) is not working and just returns to the confirm form.

    Upon investigation I found that Translatable strips the needed security token and the confirm parameter from the POST request that the publishall confirmation form sends.

    As a workaround I added the following line after line 21 in the init function of TranslatableCMSMainExtension.php . There may be a more generic way as I suspect other CMSMain functions like buildbrokenlinks() to suffer from the same problem.
          if($req->param('Action') == 'publishall') return;

    diff
    (sorry for the bad layout, preformatted text get its leading white space stripped in the forum, even when tagged as a code block)
    the line with the + in first position is the one that was added:

    TranslatableCMSMainExtension.php
    @@ -19,6 +19,7 @@
    // $Lang serves as a "context" which can be inspected by Translatable - hence it
    // has the same name as the database property on Translatable.
    $req = $this->owner->getRequest();
    + if($req->param('Action') == 'publishall') return;
    $id = $req->param('ID');
    if($req->requestVar("Locale")) {
    $this->owner->Locale = $req->requestVar("Locale");

    Cheers,
    mikg

    253 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.