Is it possible to manage custom mimetype to kind mapping? #3369
-
Hi all, Looking at how ElFinder manage the visualization of the mime types i saw that it happens in two points:
Is it possible to add some custom kinds (and then custom translations) without altering the original files? For instance, i'd like that the 'image/vnd.dxf' is presented as 'AutoCAD DXF' but in the standard files this mapping is not done... Someone else would like to show it as '3D Drawing' and so on.... If i change the files it works (of course), but i can risk to lose the changes in case of an upgrade to a new version of ElFinder. So... i was wondering if there is a way to add custom definitions by code, without relaying on the hard-coded files. Thanks in advance and kind regards. L.S.C. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@LeonSebastianCoimbra Yes, you can do that by dynamically changing the members of your elFinder instance in JavaScript. fm.bind('init', function() {
fm.kinds['image/vnd.dxf'] = 'DXF';
fm.messages['kindDXF'] = 'AutoCAD DXF';
}); By the way, "fm.kinds['image/vnd.dxf'] ='DXF';" It can be obtained from the fm.mimeTypes object, so in the next version we will be able to get it with only "fm.messages ['kindDXF'] ='AutoCAD DXF';". Online demo: https://jsbin.com/dugoyil/edit?js,output |
Beta Was this translation helpful? Give feedback.
@LeonSebastianCoimbra Yes, you can do that by dynamically changing the members of your elFinder instance in JavaScript.
By the way, "fm.kinds['image/vnd.dxf'] ='DXF';" It can be obtained from the fm.mimeTypes object, so in the next version we will be able to get it with only "fm.messages ['kindDXF'] ='AutoCAD DXF';".
Online demo: https://jsbin.com/dugoyil/edit?js,output