mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUFGFIX: Prevent selection of self as parent (see #5106) (from r99732)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102876 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8db4a28097
commit
1f5654ed19
@ -1754,9 +1754,8 @@ 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')),
|
||||
/*, new TreeMultiselectField("MultipleParents", "Page appears within", "SiteTree")*/
|
||||
@ -1800,6 +1799,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* 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',
|
||||
|
Loading…
Reference in New Issue
Block a user