mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Better failsafes for tree hints (allows move if hint for class is if not defined)
This commit is contained in:
parent
5a0eef5bab
commit
0caf1991cf
@ -63,9 +63,11 @@
|
|||||||
newParentClass = newParent.getClassname(),
|
newParentClass = newParent.getClassname(),
|
||||||
// Check allowedChildren of newParent or against root node rules
|
// Check allowedChildren of newParent or against root node rules
|
||||||
hints = self.getHints(),
|
hints = self.getHints(),
|
||||||
disallowedChildren = [];
|
disallowedChildren = [],
|
||||||
|
hintKey = newParentClass ? newParentClass : 'Root',
|
||||||
|
hint = (typeof hints[hintKey] != 'undefined') ? hints[hintKey] : null;
|
||||||
|
|
||||||
if(hints) disallowedChildren = hints[newParentClass ? newParentClass : 'Root'].disallowedChildren || [];
|
if(hint) disallowedChildren = (typeof hint.disallowedChildren != 'undefined') ? hint.disallowedChildren : [];
|
||||||
var isAllowed = (
|
var isAllowed = (
|
||||||
// Don't allow moving the root node
|
// Don't allow moving the root node
|
||||||
movedNode.data('id') != 0
|
movedNode.data('id') != 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user