From f169aa65acf91619c2aa965de283f76c1edc0e47 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Mon, 13 Oct 2014 21:55:16 +1300 Subject: [PATCH] Add support for exclude in children list --- code/controllers/DocumentationViewer.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/code/controllers/DocumentationViewer.php b/code/controllers/DocumentationViewer.php index d53a9dc..5f5a891 100755 --- a/code/controllers/DocumentationViewer.php +++ b/code/controllers/DocumentationViewer.php @@ -391,7 +391,7 @@ class DocumentationViewer extends Controller { public function includeChildren($args) { if(isset($args['Folder'])) { $children = $this->getManifest()->getChildrenFor( - Controller::join_links(dirname($this->record->getPath()), $args['Folder']) + Controller::join_links(dirname($this->record->getPath()), $args['Folder']) ); } else { $children = $this->getManifest()->getChildrenFor( @@ -399,6 +399,18 @@ class DocumentationViewer extends Controller { ); } + if(isset($args['Exclude'])) { + $exclude = explode(',', $args['Exclude']); + + foreach($children as $k => $child) { + foreach($exclude as $e) { + if($child->Link == Controller::join_links($this->record->Link(), strtolower($e), '/')) { + unset($children[$k]); + } + } + } + } + return $this->customise(new ArrayData(array( 'Children' => $children )))->renderWith('Includes/DocumentationPages');