Skip to content

Commit

Permalink
Fix excludeSiteTreeClassNames (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
axllent authored and robbieaverill committed Sep 26, 2017
1 parent 5372318 commit 6f1b166
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Model/Lumberjack.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,25 @@ public function stageChildren($showAll = false)
}

$this->owner->extend("augmentStageChildren", $staged, $showAll);
$this->excludeSiteTreeClassNames($staged);
$staged = $this->excludeSiteTreeClassNames($staged);
return $staged;
}

/**
* Excludes any hidden owner subclasses
* Excludes any hidden owner subclasses. Note that the returned DataList will be a different
* instance from the original.
*
* @param DataList $list
* @return DataList
*/
protected function excludeSiteTreeClassNames($list)
{
$classNames = $this->owner->getExcludedSiteTreeClassNames();
if ($this->shouldFilter() && count($classNames)) {
// Filter the SiteTree
$list->exclude('ClassName', $classNames);
$list = $list->exclude('ClassName', $classNames);
}
return $list;
}

/**
Expand Down Expand Up @@ -156,7 +160,7 @@ public function liveChildren($showAll = false, $onlyDeletedFromStage = false)
if (!$showAll && DataObject::getSchema()->fieldSpec($this->owner, 'ShowInMenus')) {
$children = $children->filter('ShowInMenus', 1);
}
$this->excludeSiteTreeClassNames($children);
$children = $this->excludeSiteTreeClassNames($children);

return $children;
}
Expand Down

0 comments on commit 6f1b166

Please sign in to comment.