Jump to content

PageTree - pages forced to bottom of list


dfile
 Share

Recommended Posts

Hello! I'm new here and have a question:

i want to force pages to stay at the bottom of the pagetree:

pw-forum.png

I edit the ProcessPageListRenderJSON.php and it works.

class ProcessPageListRenderJSON extends ProcessPageListRender {

	protected $systemIDs = array();

	public function __construct(Page $page, PageArray $children) {

		parent::__construct($page, $children);

		$this->systemIDs = array(
			$this->config->http404PageID,
			$this->config->adminRootPageID,
			$this->config->trashPageID,
			$this->config->loginPageID,
			//system login ####################################################
			1088,
			1036,
			###################################################################
		);
	}

Is there a way to do this without hardcode it in the ProcessPageListRenderJSON.php?

Link to comment
Share on other sites

i edit the render function in ProcessPageListRenderJSON.php

	public function render() {

		$children = array();

		###############################################
		$toBottom=array(
		//system, login ###################################
			1088,
			1036,
			);

		$bottomPages=array(); // pages forced to bottom of list
		$extraPages = array(); // pages forced to bottom of list

		foreach($this->children as $page) {
			if(!$this->superuser && !$page->listable()) continue;

			if(in_array($page->id, $this->systemIDs)) {
				$extraPages[] = $page;
				continue;
			}
			
			if(in_array($page->id,$toBottom)) {
				$bottomPages[] = $page;
				continue;

			}	
	
			$child = $this->renderChild($page);
			$children[] = $child;

		}

		foreach($bottomPages as $page) { //bottomPages
			$children[] = $this->renderChild($page);
		}

		if($this->superuser) foreach($extraPages as $page) {//extraPages 
			$children[] = $this->renderChild($page);
		}

that works for me.

Link to comment
Share on other sites

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...