ENHANCEMENT Allowing for passing of $context in Hierarchy->markChildren()

BUGFIX Making sure a valid DataObjectSet is returned from Hierarchy->stageChildren()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@69909 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-01-08 05:52:20 +00:00 committed by Sam Minnee
parent 941a9eb7bd
commit e25a15893e

View File

@ -139,8 +139,8 @@ class Hierarchy extends DataObjectDecorator {
* Mark all children of the given node that match the marking filter.
* @param DataObject $node Parent node.
*/
public function markChildren($node) {
$children = $node->AllChildrenIncludingDeleted();
public function markChildren($node, $context = null) {
$children = $node->AllChildrenIncludingDeleted($context);
$node->markExpanded();
if($children) {
foreach($children as $child) {
@ -492,6 +492,7 @@ class Hierarchy extends DataObjectDecorator {
$extraFilter = $showAll ? '' : " AND ShowInMenus = 1";
$baseClass = ClassInfo::baseDataClass($this->owner->class);
$staged = DataObject::get($baseClass, "`{$baseClass}`.`ParentID` = " . (int)$this->owner->ID . " AND `{$baseClass}`.ID != " . (int)$this->owner->ID . $extraFilter, "");
if(!$staged) $staged = new DataObjectSet();
$this->owner->extend("augmentStageChildren", $staged, $showAll);
return $staged;
}