Studio-42 / elFinder

📁 Open-source file manager for web, written in JavaScript using jQuery and jQuery UI
https://studio-42.github.io/elFinder/
Other
4.64k stars 1.42k forks source link

Bind events in custom driver #3624

Closed applibs closed 6 months ago

applibs commented 9 months ago

My custom driver is extender like this: class elFinderVolumeCustom extends elFinderVolumeDriver

in construct of custom class:

$opts = [
            'host'         => '1',
            'root'         => 'custom',
            'path'         => '/',
            'separator'    => '/',
            'treeDeep'     => 0,
            'keyword'      => '',
            'img_width'    => 1024,
            'img_height'   => 1024,
            'tmbPath'      => '',
            'tmbURL'       => 'custom_url',
            'tmbSize'      => 48,
            'tmbCrop'      => false,
            'tmpPath'      => '',
            'rootCssClass' => 'elfinder-navbar-root-custom',
            'mimeDetect'   => 'internal',
            'bind'         => [
                'paste.copyfrom' => [
                    'onCopyFrom'
                ]
            ]
        ];
        $this->options = array_merge($this->options, $opts);

In my class is function onCopyFrom.

When I copy file in mydriver and paste at localstoragedriver I debug at: elFinder::$instance->trigger('paste.copyfrom', array(&$thash, &$name, '', elFinder::$instance, $this), $errors);

and inside trigger function is array: $this->listeners and its missing by binded function. Seems that its not there.

applibs commented 9 months ago

I also tried create custom plugin which will copy file from source to target on event $bind['paste.copyfrom']. But in plugin is only filename. Plugin architecture missing source path and destination path.

applibs commented 9 months ago

I will be happy, when this call: elFinder::$instance->trigger('paste.copyfrom', array(&$thash, &$name, '', elFinder::$instance, $this), $errors);

will looks like this: elFinder::$instance->trigger('paste.copyfrom', array(&$thash, &$name, '', elFinder::$instance, $this, $source, $destination), $errors); Then over plugin with function: public function onCopyFrom($cmd, $filename, $args, $elfinder, $volume, $src, $destination)

I can manage all what I need.

github-actions[bot] commented 7 months ago

This issue is stale because it has been open for 50 days with no activity.

github-actions[bot] commented 6 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

applibs commented 6 months ago

Is it possible implement my reccomendation?