PHPackages                             micschk/silverstripe-excludechildren - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. micschk/silverstripe-excludechildren

Abandoned → Replaced by core functionality, see excludechildren READMEArchivedSilverstripe-module[Utility &amp; Helpers](/categories/utility)

micschk/silverstripe-excludechildren
====================================

Extension to hide pages from the SiteTree

2.0(8y ago)1922.5k102PHP

Since Jan 27Pushed 8y ago1 watchersCompare

[ Source](https://github.com/micschk/silverstripe-excludechildren)[ Packagist](https://packagist.org/packages/micschk/silverstripe-excludechildren)[ RSS](/packages/micschk-silverstripe-excludechildren/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (4)Used By (2)

Replaced by core functionality in SS3.5+
========================================

[](#replaced-by-core-functionality-in-ss35)

**Thanks to everyone who installed this extension to hide pages from the SiteTree (almost 16.5K composer installs since 2012).**Since comparable functionality has ben added to SilverStripe framework (Hierarchy), I'm not updating this module to SS4.

I've tagged a 2.0 release marking incompatibility from SS3.5 upwards (in composer), this should prompt users to migrate to core functionality as described below. I'll leave this repo as-is so please open a ticket if this causes any problems for you and I'll to my best to sort things out.

The 1.1 release should remain be usable on any SS3 version if needed, but I recommend simply uninstalling this module from SS3.5 onward and updating your config as follows instead:

Configuring hidden pages in SS3.5+
----------------------------------

[](#configuring-hidden-pages-in-ss35)

### $hide\_from\_cms\_tree hides in CMS, not in front-end

[](#hide_from_cms_tree-hides-in-cms-not-in-front-end)

**Hiding pagetypes in the CMS, in general**

```
SilverStripe\ORM\Hierarchy\Hierarchy:
  hide_from_cms_tree:
    - 'PageClassToHide'
```

**Hiding pagetypes in the CMS, only if sub-page of a 'holder' pagetype**

```
HiddenPageHolderClass:
  hide_from_cms_tree:
    - 'PageClassToHide'
```

### $hide\_from\_hierarchy hides both in CMS &amp; front-end

[](#hide_from_hierarchy-hides-both-in-cms--front-end)

**Hiding page types in both the CMS &amp; Front-end, in general**

```
SilverStripe\ORM\Hierarchy\Hierarchy:
  hide_from_hierarchy:
    - 'PageClassToHide'
```

**Hiding page types in both the CMS &amp; Front-end, only if sub-page of a 'holder' pagetype**

```
HiddenPageHolderClass:
  hide_from_hierarchy:
    - 'PageClassToHide'
```

Managing 'hidden' pages in SS3.5+
---------------------------------

[](#managing-hidden-pages-in-ss35)

Manage hidden pages using a Gridfield (see: [silverstripe-gridfieldsitetreebuttons](https://github.com/micschk/silverstripe-gridfieldsitetreebuttons)) on the holder page or use a ModelAdmin or similar.

Of course there's also the very inspireding Lumberjack module (but you've probably seen that being plugged already)... (/sarcasm)

Getting 'hidden' pages in front-end
-----------------------------------

[](#getting-hidden-pages-in-front-end)

If using `$hide_from_hierarchy`, hidden pages will not be included in `$Children` loops. Instead, they can be queries using something like:

```
	public function HiddenChildren(){
		return SiteTree::get()->filter('ParentID', $this->ID)->sort('Sort');
	}
```

Or, paginated:

```
	public function PaginatedChildren(){
		$children = SiteTree::get()->filter('ParentID', $this->ID);
		$ctrlr = Controller::curr();
		$children = new PaginatedList($children, $ctrlr->request);
		$children->setPageLength(10);
		return $children;
	}
```

Legacy: using excludechildren module (in SS&lt;3.5)
===================================================

[](#legacy-using-excludechildren-module-in-ss35)

Requirements
------------

[](#requirements)

- SilverStripe 3.0 or newer (&lt;3.5)

Screenshot
----------

[](#screenshot)

*Hide SiteTree items from from the sitetree (and, with some extra code/modules, manage them from a GridField):*[![](images/screenshots/holderscreen.png)](images/screenshots/holderscreen.png)

Installation
------------

[](#installation)

```
composer require micschk/silverstripe-excludechildren dev-master

```

Usage
-----

[](#usage)

In config.yml (best):

```
---
Only:
  classexists: 'ExcludeChildren'
---
SubPageHolder:
  extensions:
	- 'ExcludeChildren'
  excluded_children:
	- 'SubPage'
	- 'AnotherPageType'
  # optionally exclude from theme $Children as well (set to true if desired, default only from CMS)
  # eg. to exclude pre-existing child pages with 'show in menus' = true
  force_exclusion_beyond_cms: false
```

Or in your Page class (php):

```
	class SubPageHolder extends Page {
		...
		static $extensions = array("ExcludeChildren");
		static $excluded_children = array('SubPage', 'AnotherPageType_Extending_Page');
		...
```

Or externally via \_config.php:

```
		Object::add_extension("SubPageHolder", "ExcludeChildren");
		Config::inst()->update("SubPageHolder", "excluded_children", array("BlogEntry"));
```

\###Then, add a GridField instead to create/edit subpages (See Gridfieldpages module below for a turnkey solution/example)

```
	$gridFieldConfig = GridFieldConfig::create()->addComponents(
		new GridFieldToolbarHeader(),
		new GridFieldAddNewSiteTreeItemButton('toolbar-header-right'), // GridfieldSitetreebuttons module
		new GridFieldSortableHeader(),
		new GridFieldFilterHeader(),
		$dataColumns = new GridFieldDataColumns(),
		new GridFieldPaginator(20),
		new GridFieldEditSiteTreeItemButton(), // GridfieldSitetreebuttons module
		new GridFieldOrderableRows() // Gridfieldextensions module, default 'Sort' is equal to page sort field...
	);
	$dataColumns->setDisplayFields(array(
		'Title' => 'Title',
		'URLSegment'=> 'URL',
		//'getStatus' => 'Status', // Implement getStatus() on child page class, see gridfieldpages module for an example
		'LastEdited' => 'Changed',
	));
	// use gridfield as normal
	$gridField = new GridField(
		"SubPages", # Can be any name, field doesn't have to exist on model...
		"SubPages of this page",
        SiteTree::get()->filter('ParentID', $this->ID),
		$gridFieldConfig);
    $fields->addFieldToTab("Root.SubPages", $gridField);
```

Looping over $Children in templates
-----------------------------------

[](#looping-over-children-in-templates)

This module only hides child pages from the CMS sitetree by default. So you can just use $Children as usual in your theme. Child pages will also be available when creating links to pages from the CMS editor.

When excluding pages from the front-end as well (force\_exclusion\_beyond\_cms), you can add an alternative getter to your Holder:

```
	public function SortedChildren(){
		return SiteTree::get()->filter('ParentID', $this->ID)->sort('Sort');
	}
```

Or, paginated:

```
	public function PaginatedChildren(){
		$children = SiteTree::get()->filter('ParentID', $this->ID);
		$ctrlr = Controller::curr();
		$children = new PaginatedList($children, $ctrlr->request);
		$children->setPageLength(10);
		return $children;
	}
```

Things to check if your pages are not showing up in $Children:

- is force\_exclusion\_beyond\_cms set to false (or use custom getter)?
- are your child pages set to appear in menu's (show in menu's)?

Customising your children
-------------------------

[](#customising-your-children)

If you need to customise your hidden children by more than just classname you can implement the `getExcludedChildren` which needs to return a `DataList` of the children *to show* in the SiteTree.

Pro tip
-------

[](#pro-tip)

Add GridfieldSitetreebuttons to your gridfieldconfig to edit the pages in their regular edit forms:

- [silverstripe-gridfieldsitetreebuttons](https://github.com/micschk/silverstripe-gridfieldsitetreebuttons)

Or use/subclass the preconfigured GridfieldPages module, which contains both excludechildren, sitetreebuttons, sorting and publication status:

- [silverstripe-gridfieldpages](https://github.com/micschk/silverstripe-gridfieldpages)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 61.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~591 days

Total

3

Last Release

2947d ago

Major Versions

1.1 → 2.02018-04-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d3680d6353e5f171543435b89965ba2588186ad7ec0ec97cbf572704fec2a4f?d=identicon)[micschk](/maintainers/micschk)

---

Top Contributors

[![micschk](https://avatars.githubusercontent.com/u/1005986?v=4)](https://github.com/micschk "micschk (16 commits)")[![icecaster](https://avatars.githubusercontent.com/u/556788?v=4)](https://github.com/icecaster "icecaster (3 commits)")[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (2 commits)")[![thezenmonkey](https://avatars.githubusercontent.com/u/1685217?v=4)](https://github.com/thezenmonkey "thezenmonkey (1 commits)")[![briceburg](https://avatars.githubusercontent.com/u/490144?v=4)](https://github.com/briceburg "briceburg (1 commits)")[![xini](https://avatars.githubusercontent.com/u/1152403?v=4)](https://github.com/xini "xini (1 commits)")[![spekulatius](https://avatars.githubusercontent.com/u/8433587?v=4)](https://github.com/spekulatius "spekulatius (1 commits)")[![sunnysideup](https://avatars.githubusercontent.com/u/167154?v=4)](https://github.com/sunnysideup "sunnysideup (1 commits)")

---

Tags

silverstripesitetreeexcludechildren

### Embed Badge

![Health badge](/badges/micschk-silverstripe-excludechildren/health.svg)

```
[![Health](https://phpackages.com/badges/micschk-silverstripe-excludechildren/health.svg)](https://phpackages.com/packages/micschk-silverstripe-excludechildren)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
