Last active
March 3, 2017 10:25
-
-
Save m-engel/60a107e14fe5b2cac285 to your computer and use it in GitHub Desktop.
Disable Drag&Drop Resources out of Containers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Event: OnManagerPageBeforeRender | |
$script = "<script> | |
var ResourceTreeHandleDrop = MODx.tree.Resource.prototype._handleDrop; | |
Ext.override(MODx.tree.Resource, { | |
_handleDrop:function(e){ | |
var dropNode = e.dropNode; | |
var targetParent = e.target; | |
if(dropNode.getDepth() != targetParent.getDepth() || (e.point == 'append')) return false; | |
if(dropNode.parentNode.id != targetParent.parentNode.id) return false; | |
return ResourceTreeHandleDrop(e); | |
} | |
}); | |
</script>"; | |
$controller->head['html'][] = $script; | |
return true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment