javascriptjqueryelfinder

Elfinder how to customize menu


Hi I'm using elfinder and I want to remove delete and empty folder option. How do I remove it. Here is my code.

<script>
        $(function() {
            $('#elfinder').elfinder({   // 1st Arg - options
                    cssAutoLoad : false,// Disable CSS auto loading
                    baseUrl : './',// Base URL to css/*, js/*
                    url : 'php/connector.minimal.php',// Connector URL
                    getFileCallback : function(file) {/* ... */},// Callback when a file is double-clicked
                    width: '100%',
                    height: $(window).height() - 20                                                            
                });
        });</script>

Solution

  • try this code:

    <script>
    $(function() {
        $('#elfinder').elfinder(
        // 1st Arg - options
        {
            // Disable CSS auto loading
            cssAutoLoad: false,
            // Base URL to css/*, js/*
            baseUrl: './',
            // Connector URL
            url: 'php/connector.minimal.php',
            // Callback when a file is double-clicked
            getFileCallback: function(file) {
                // ...
            },
            uiOptions: {
                // toolbar configuration
                toolbar: [
                    ['home', 'back', 'forward', 'up', 'reload'],
                    ['mkdir', 'mkfile', 'upload'],
                    ['open', 'download', 'getfile'],
                    ['undo', 'redo'],
                    ['copy', 'cut', 'paste'],
                    ['duplicate', 'rename', 'edit', 'resize', 'chmod'],
                    ['selectall', 'selectnone', 'selectinvert'],
                    ['quicklook', 'info'],
                    ['extract', 'archive'],
                    ['search'],
                    ['view', 'sort'],
                    ['fullscreen']
                ]
            },
            contextmenu: {
                // navbarfolder menu
                navbar: ['open', 'download', '|', 'upload', 'mkdir', '|', 'copy', 'cut', 'paste', 'duplicate', '|', '|', 'rename', '|', 'places', 'info', 'chmod', 'netunmount'],
                // current directory menu
                cwd: ['undo', 'redo', '|', 'back', 'up', 'reload', '|', 'upload', 'mkdir', 'mkfile', 'paste', '|', '|', 'view', 'sort', 'selectall', 'colwidth', '|', 'info', '|', 'fullscreen', '|'],
                // current directory file menu
                files: ['getfile', '|', 'open', 'download', 'opendir', 'quicklook', '|', 'upload', 'mkdir', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'empty', '|', 'rename', 'edit', 'resize', '|', 'archive', 'extract', '|', 'selectall', 'selectinvert', '|', 'places', 'info', 'chmod', 'netunmount']
            },
            width: '100%',
            height: $(window).height() - 20
        });
    });
    </script>
    

    You can also customize menu from elFinder.options.js file. already mentioned everything in client configuration check...!!!