mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUFGFIX: Prevent selection of self as parent (see #5106)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@99732 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
4a09702d63
commit
d6b219957a
@ -1722,7 +1722,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
||||
"root" => _t("SiteTree.PARENTTYPE_ROOT", "Top-level page"),
|
||||
"subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page (choose below)"),
|
||||
)),
|
||||
new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree'),
|
||||
$parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree'),
|
||||
|
||||
new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')),
|
||||
new CheckboxField("ShowInSearch", $this->fieldLabel('ShowInSearch')),
|
||||
@ -1769,6 +1769,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
||||
//new NamedLabelField("Status", $message, "pageStatusMessage", true)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* This filter ensures that the ParentID dropdown selection does not show this node,
|
||||
* or its descendents, as this causes vanishing bugs.
|
||||
*/
|
||||
$parentIDField->setFilterFunction(create_function('$node', "return \$node->ID != {$this->ID};"));
|
||||
|
||||
if ($virtualPagesTable->TotalCount()) {
|
||||
$rootTab->push($tabVirtualPages = new Tab('VirtualPages',
|
||||
$virtualPagesNote,
|
||||
|
Loading…
x
Reference in New Issue
Block a user