PWaddict Posted January 8, 2019 Share Posted January 8, 2019 I would like to move a page under "Setup" menu but when I do that by pressing the "move" button and then dragging it under Admin > Setup it doesn't displayed in Setup's dropdown menu. How to do it properly? Link to comment Share on other sites More sharing options...
gebeer Posted January 8, 2019 Share Posted January 8, 2019 From the page edit screen under settings you can change the parent of the page and choose Setup there. Link to comment Share on other sites More sharing options...
adrian Posted January 8, 2019 Share Posted January 8, 2019 It's not that simple - pages under Admin > Setup need to have the "admin" template and they need to have a process assigned to them. Creating a process module is probably what you are looking to do. Check out @bernhard's blog post tutorial: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ 3 Link to comment Share on other sites More sharing options...
PWaddict Posted January 8, 2019 Author Share Posted January 8, 2019 On that page I want to move under Setup I also have a repeater field that uses LimitRepeater module and I'm wondering if it will still function on a process module. How will I be able to output fields content on frontend? Currently I'm doing this since it's just a page: $settings = $pages->get("template=settings"); echo $settings->my_field; Link to comment Share on other sites More sharing options...
adrian Posted January 8, 2019 Share Posted January 8, 2019 Can I recommend @Macrura's excellent module: http://modules.processwire.com/modules/settings-factory/ Link to comment Share on other sites More sharing options...
PWaddict Posted January 8, 2019 Author Share Posted January 8, 2019 @Robin S informed me that it's not possible to use a repeater field in a process module. Maybe if I create a process module that will redirect to the page I want to move under Setup... Link to comment Share on other sites More sharing options...
PWaddict Posted January 8, 2019 Author Share Posted January 8, 2019 (edited) 4 hours ago, PWaddict said: Maybe if I create a process module that will redirect to the page I want to move under Setup... That seems to be the best solution. Here is the code for the ProcessSettings module: <?php namespace ProcessWire; /** * Settings Module * ProcessWire 3.x, Copyright 2018 by Ryan Cramer * https://processwire.com * */ class ProcessSettings extends Process { public static function getModuleInfo() { return array( 'title' => 'Settings', 'version' => "1.0.0", 'summary' => "Modify site settings", 'permission' => 'settings-view', 'singular' => false, 'autoload' => false, 'author' => "PWaddict", 'icon' => 'cog', 'page' => array( 'name' => 'settings', 'parent' => 'setup', 'title' => 'Settings' ) ); } public function execute() { $settings = $this->pages->get("template=settings"); $this->session->redirect($this->wire('config')->urls->admin.'page/edit/?id='.$settings->id, false); // false = 302 temporary redirect } } and with my HidePages module I hide the Settings page from the Pages tree for non-superusers so they can only access it from Setup menu. Edited January 9, 2019 by PWaddict public function init() replaced with execute cause it wasn't possible to uninstall the module. 4 Link to comment Share on other sites More sharing options...
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