Jump to content

[SOLVED] How to properly move a page under "Setup" menu?


PWaddict
 Share

Recommended Posts

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

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 by PWaddict
public function init() replaced with execute cause it wasn't possible to uninstall the module.
  • Like 4
Link to comment
Share on other sites

  • PWaddict changed the title to [SOLVED] How to properly move a page under "Setup" menu?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...