Jump to content

new page nav in admin


robrainfall
 Share

Recommended Posts

How could i accomplish this?

I would like to have in the admin a second page navigation and I would like to able to move some elements from the default page navigation to the other one. The element and their children.

Any ideas on this?

post-533-0-15421500-1336377721_thumb.jpg

Link to comment
Share on other sites

Hi, and welcome to the forum!

What you are asking is not that simple because this is not the way that ProcessWire is designed to work. It's not impossible though, and if you have the skills to create a module you can do it. I can't help you a lot with this, but maybe someone who can will jump in the discussion.

What I can do is help you to get started. Here it goes :)

To make a page appear in the admin navigation, you just have to make sure that it is children of the admin page in the tree. You can do this with any page with any template.

If you want this page to behave and look like the other admin pages, you will have to give it the admin template... go ahead an try it... when you do this, the page will simply say "This page has no Process assigned". This means, you will have to create a process module that does what you want and assign it to the page you created.

If you edit the page and choose from the several processes that already exists, you can see how it works.

The process modules are on the wire/modules/Process folder of your PW install, have a look at some of them to get a feel of how it works.

  • Like 2
Link to comment
Share on other sites

Hey rob.

What diogo said. You can create a admin page using the "admin" template. It would be placed under the locked "admin" page tree.

The admin template has a field "Process". After creating the page you'll see it under tab "content".

Now you have to create a process module to serve functionality for the newly created admin page.

Once installed it can be selected from the field "Process".

I did a quick example that shows such a module, and even how to use the ProcessPageList module of processwire to create a tree. The id set will be the parent page (your Architects) for example.

ProcessPageListCustom.module

create the module under /site/modules/ and install it.

<?php

class ProcessPageListCustom extends Process{

public static function getModuleInfo() {
	return array(
		'title' => 'Custom Page List',
		'summary' => 'List pages in a hierarchal tree structure',
		'version' => 100,
		'permission' => 'page-edit'
		);
}

public function execute(){
	$pl = $this->modules->get("ProcessPageList");
	$pl->set('id',1001); // or any other parent page
	return $pl->execute();
}

}

You can, of course, use any code to generate a list of pages.

  • Like 9
  • Thanks 1
Link to comment
Share on other sites

While testing this module with the ProcessPageList rendering a part of the page tree, I recognized a strange behaviour.

When I enter the get "open=" (processwire/test/?open=1008) to the url it adds another set of childs (duplicate) but opens the page correctly (the one in the get / which are now doubled too).

Link to comment
Share on other sites

  • 2 weeks later...
When I enter the get "open=" (processwire/test/?open=1008) to the url it adds another set of childs (duplicate) but opens the page correctly (the one in the get / which are now doubled too).

I think this issue here is that 'open' and 'id' aren't meant to be used together. It's meant to be one or the other. When they are both used, you'll get duplication. Maybe there is a use for them to work together, and it could probably be done, but it's not come up as a need yet. Though if someone else has a use for it, I'll be happy to take a closer look to see what might be possible in the future.

Link to comment
Share on other sites

  • 1 year later...

Hey rob.

What diogo said. You can create a admin page using the "admin" template. It would be placed under the locked "admin" page tree.

The admin template has a field "Process". After creating the page you'll see it under tab "content".

Now you have to create a process module to serve functionality for the newly created admin page.

Once installed it can be selected from the field "Process".

I did a quick example that shows such a module, and even how to use the ProcessPageList module of processwire to create a tree. The id set will be the parent page (your Architects) for example.

ProcessPageListCustom.module

create the module under /site/modules/ and install it.

<?php

class ProcessPageListCustom extends Process{

	public static function getModuleInfo() {
		return array(
			'title' => 'Custom Page List',
			'summary' => 'List pages in a hierarchal tree structure',
			'version' => 100,
			'permission' => 'page-edit'
			);
	}

	public function execute(){
		$pl = $this->modules->get("ProcessPageList");
		$pl->set('id',1001); // or any other parent page
		return $pl->execute();
	}
	
}

You can, of course, use any code to generate a list of pages.

Does this still work? I'm testing it out with several different parent IDs, but the admin page always returns the full, default tree.

Edit:

Oops it does - one clarification is that whatever you name the class, you have to pick that from the dropdown for the admin page after the module's installed.

Link to comment
Share on other sites

  • 7 months later...

I'm wondering if there's a way to hook into the execute function to return a page list that is filtered by template or something other than parent. Or maybe say by parent and then filtered again by some other variable?

I'd like to have some pages that share a parent but have different templates - which is no problem - but I'd also like to be able to quickly see each page type in a list. 

Does anyone know if there's a way to accomplish this?

Link to comment
Share on other sites

  • 1 year later...

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

×
×
  • Create New...