Client Configuration¶
elFinder can be configured in different ways:
1. during initialization:
1 $(selector).elfinder({
2 option1: value1,
3 option2: value2
4 })
2. before initialization and after elFinder files include (you can configure all options this way):
1 var opts = {
2 option1: value1,
3 option2: value2,
4 option3: value3
5 }
6 elFinder.prototype.options = $.extend({}, elFinder.prototype.options, opts)
or just some options:
1 elFinder.prototype.options.option1 = value1;
Options¶
| option | type | description |
|---|---|---|
| url | String | connector URL. The only required option |
| lang | String | Interface language. Require to include file js/i18n/elfinder.LANG.js, where LANG is two-letter language code, for example ru |
| cssClass | String | Additional CSS class for container |
| wrap | Integer | Number of symbols to show in a row when splitting long filenames in "icons" view. By default - 14. Do not split log filenames - 0 |
| places | String | Folder name for "favorites". Can be localized. By default - Places. You can set this to empty string "" to disable "favorites" |
| placesFirst | Boolean | Place "favorites" before file tree in navigation panel. By default - true |
| editorCallback | Function or null | Callback function for WYSIWYG editor (CKEditor, TinyMCE, elRTE etc...). This function will get argument (String) - URL of selected file |
| cutURL | String | Cut string from the URL when calling editorCallback, to cut base url use special value root |
| closeOnEditorCallback | Boolean | Close elFinder after calling editorCallback? By default - true. (useless for CKEditor, TinyMCE) |
| view | String | Default directory view. Possible values: icons, list. By default - icons |
| width | Integer or String | Width of file manager. By default not set, but takes value from CSS file source:src/css/elfinder.css |
| height | Integer | Height of file manager. By default not set, also can be set in CSS |
| disableShortcuts | Boolean | Disable shortcut keys (except arrows and space). By default - false |
| rememberLastDir | Boolean | Open last visited directory after page reload or after browser restart |
| cookie | Object | Set cookie (stores current view, last visited directory, "favorites"). By default - {expires : 30, domain : '', path : '/', secure : false} |
| toolbar | Array | Groups of icons in toolbar. By default - all available buttons/commands. For more info visit docs |
| contextmenu | Object | Contents of context menu. By default - all available commands. For more info visit docs |
| dialog | Object | jQueryUI dialog options with which elFinder will be opened. If docked == true - elFinder will be opened with "undock" feature (make it dialog window) |
| docked | Boolean | Allow "undock" feature (can be refered in docks as "docked mode") |
| autoReload | Integer | Amount of munites after which to update current directory contents. By default - 0 (disabled) |
Toolbar¶
By default all buttons/commands are present in toolbar. If command is disabled in connector button wouldn't show in toolbar, even if it is configured in client.
Option toolbar (Array) groups
Опция toolbar (Array) - two-dimensional array. First level - of icons, groups are visualy seperated in toolbar. Second level - buttons inside group. Groups of icons and icons in group will be shown in the same order as in config.
List of all available buttons: back, reload, open, select, quicklook, info, rename, copy, cut, paste, rm, mkdir, mkfile, upload, duplicate, edit, archive, extract, resize, icons, list, help.
Example:
1 $(selector).elfinder({
2 toolbar : [
3 ['back', 'reload'],
4 ['select', 'open'],
5 ['mkdir', 'mkfile', 'upload']
6 ],
7 ...
8 })
Context menu¶
Context menu can be redefined by option contextmenu (Object).
Example:
1 $(selector).elfinder({
2 contextmenu : {
3 // Commands that can be executed for current directory
4 cwd : ['reload', 'delim', 'mkdir', 'mkfile', 'upload', 'delim', 'paste', 'delim', 'info'],
5 // Commands for only one selected file
6 file : ['select', 'open', 'delim', 'copy', 'cut', 'rm', 'delim', 'duplicate', 'rename'],
7 // Coommands for group of selected files
8 group : ['copy', 'cut', 'rm', 'delim', 'archive', 'extract', 'delim', 'info']
9 },
10 ...
11 })