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, biapar, Willr, Ingo, swaiba, simon_w

Translatable and 3.1 - publishall not working - hack


Reply

276 Views

Avatar
mikg

25 April 2013 at 8:28pm (Last edited: 26 April 2013 8:15pm), Community Member, 1 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