Adam Kiss Posted April 11, 2011 Posted April 11, 2011 Edit: THIS HACK HAS BEEN SURPASSED BY THIS PLUGIN: http://processwire.com/talk/index.php/topic,255.0.html PLEASE USE IT INSTEAD OF THIS QUICK TIP/HACK Are you one of those assholes, who just love to fiddle with everything so it suits your needs? No worries. Me too. And I really hate the fact, that processwire stays on the 'Edit page' after saving page, so here is a quick tip: [non-tested with the fantastic Antti's AdminBar]: Locate the file /wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module and change line 143 from: <?php if(!$this->redirectUrl) $this->redirectUrl = "./?id={$this->page->id}"; to <?php if(!$this->redirectUrl) $this->redirectUrl = "/processwire/page/?open={$this->page->id}"; And voilà! ProcessWire now opens PageList with awesome list animation after saving. Note: Do not look for '<?php' near that line. That was added here just kick in code coloring. Important is just that if(!$this... part
ryan Posted April 11, 2011 Posted April 11, 2011 Adam, good tip. The only potential problem I can see here is that when you upgrade that update will get wiped out. Here's a way to do it in an upgrade-friendly way. Paste this into a file called RedirectPageEdit.module in /site/modules/. Or download it from the thread in the Modules forum (I'm going to post the file there). /site/modules/RedirectPageEdit.module: <?php class RedirectPageEdit extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Redirect PageEdit', 'version' => 100, 'summary' => 'Redirects PageEdit to return to PageList after save rather than edit again.', 'singular' => true, 'autoload' => true, ); } public function init() { $this->session->addHookBefore('redirect', $this, 'myRedirect'); } public function myRedirect(HookEvent $event) { if($this->process == 'ProcessPageEdit' && preg_match('{^\./\?id=(\d+)$}', $event->arguments[0], $m)) { $event->arguments = array($this->config->urls->admin . "page/?open=$m[1]"); } } }
apeisa Posted April 11, 2011 Posted April 11, 2011 [non-tested with the fantastic Antti's AdminBar]: I tested Ryan's module for this quickly with AdminBar, and there is no problems, works nicely.
Adam Kiss Posted April 11, 2011 Author Posted April 11, 2011 @Ryan: Well, this was used on websites, that won't be updated, unless we'll find some serious security issue, which I doubt, so I'm quite okay with it But, I will use that module you posted for sure, later
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now