mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
941a9eb7bd
commit
e25a15893e
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user