mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
Add support for exclude in children list
This commit is contained in:
parent
7f778498f2
commit
f169aa65ac
@ -391,7 +391,7 @@ class DocumentationViewer extends Controller {
|
|||||||
public function includeChildren($args) {
|
public function includeChildren($args) {
|
||||||
if(isset($args['Folder'])) {
|
if(isset($args['Folder'])) {
|
||||||
$children = $this->getManifest()->getChildrenFor(
|
$children = $this->getManifest()->getChildrenFor(
|
||||||
Controller::join_links(dirname($this->record->getPath()), $args['Folder'])
|
Controller::join_links(dirname($this->record->getPath()), $args['Folder'])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$children = $this->getManifest()->getChildrenFor(
|
$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(
|
return $this->customise(new ArrayData(array(
|
||||||
'Children' => $children
|
'Children' => $children
|
||||||
)))->renderWith('Includes/DocumentationPages');
|
)))->renderWith('Includes/DocumentationPages');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user