Skip to content

Instantly share code, notes, and snippets.

@m-engel
Last active August 5, 2018 20:51
Show Gist options
  • Save m-engel/8519a5a4ace3321a56199ea97bd8734b to your computer and use it in GitHub Desktop.
Save m-engel/8519a5a4ace3321a56199ea97bd8734b to your computer and use it in GitHub Desktop.
MODX FilesTree Drag onlyfiles
// Event: OnManagerPageBeforeRender
$script = "<script>
DirectoryTreeHandleDrop = MODx.tree.Directory.prototype._handleDrop;
Ext.override(MODx.tree.Directory, {
_handleDrop:function(e){
var dropNode = e.dropNode;
var targetParent = e.target;
if(dropNode.hasChildNodes()) return false;
return DirectoryTreeHandleDrop(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