Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Revove Pages from CMS Sitetree


Go to End


4 Posts   1536 Views

Avatar
DeklinKelly

Community Member, 197 Posts

14 August 2010 at 6:39am

I want to remove all pages with a page class of "Video" from the CMS sitetree.

Attached Files
Avatar
swaiba

Forum Moderator, 1899 Posts

18 August 2010 at 3:23am

I've looked into this, but haven't got there yet... this is from my notes... (you'll need to replace 'Logger' with your own method of debugging... a solution would be much appreciated by me too as I gave up!

class Hierarchy {

	...

	function getChildrenAsUL {
		Logger::log($this);

		if (isset($this->ClassName))
		{
			Logger::log($this->ClassName);

			$do = new DataObject();
			$do->setCalssName($this->ClassName);
			$strName = get_parent_class($do);

			if ($strName == 'YOURPAGECLASS')
				return '';
		}

		...

		}

		...

}

Avatar
frankmullenger

Forum Moderator, 53 Posts

20 October 2010 at 4:27pm

You can use the static $hide_ancestor var in class SiteTree but can only hide an ancestor I imagine, rather than any class.

Avatar
swaiba

Forum Moderator, 1899 Posts

20 October 2010 at 11:49pm

With this I ended up making my pages non-existent in the sitetree, rather than hiding them...