helios-ag / FMElfinderBundle

:file_folder: ElFinderBundle provides ElFinder integration with TinyMCE, CKEditor, Summernote editors
MIT License
275 stars 128 forks source link

I can't trigger the PRE/POST Execution events #514

Open BackNot opened 9 months ago

BackNot commented 9 months ago

Describe the bug I want to trigger the events, but it seems that it doesn't happen. If I understood correctly they should be triggered on elfinder actions like "open", etc.

To Reproduce I use symfony 6.2 and version 12.3 of elfinder bundle.

My fm_elfinder.yaml:

fm_elfinder:
  instances:
    default:
      editor: ckeditor
      cors_support : true 
      connector:
        roots:
          uploads:
            driver : LocalFileSystem
            path : ../uploads
            url : /show
            upload_deny: ['all']
            upload_allow: [
              'text/plain',
              'application/pdf',
              'application/x-pdf',
              'image/bmp',
              'application/msword',
              'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
              'image/gif',
              'image/jpeg',
              'application/vnd.oasis.opendocument.presentation',
              'application/vnd.oasis.opendocument.spreadsheet',
              'application/vnd.oasis.opendocument.text',
              'image/png',
              'application/vnd.ms-powerpoint',
              'application/vnd.openxmlformats-officedocument.presentationml.presentation',
              'application/vnd.ms-excel',
              'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            ]
            upload_max_size: 10M
            alias: Home

My services.yaml:

  post_execution_listener :
    class : App\EventListener\PostExecutionListener
    tags :
      - { name : fm_elfinder.event_listener, event : fm_elfinder.event.post_execution, method : onPostExecute }

PostExecutionListener:

namespace App\EventListener;

use FM\ElfinderBundle\Event\ElFinderPostExecutionEvent;

class PostExecutionListener
{
    public function onPostExecute(ElFinderPostExecutionEvent $event): void
    {
        dd("HERE");
    }
}

Am I missing something?

Thanks.

helios-ag commented 9 months ago

I think they not working right now, they were introduced when we relied on separate elfinder-php lib (that was extracted from original project). Probably if you extend Connector class (or even add there, and create PR), and fire events from there, they will work.

Daniel-Ovejero commented 6 months ago

Hello any updates on this ?

BackNot commented 6 months ago

I could not make the events work. However I accomplished my task by using custom elfinder configurator which is used prior to loading of elfinder:

In fm_elfinder.yaml:

fm_elfinder:
  configuration_provider : elfinder_custom_configurator

services.yaml:

  elfinder_custom_configurator :
    class : App\Folder\ElfinderCustomConfigurator
    arguments : [ "@fm_elfinder.configurator.default" ]

And then in this class I changed some properties of elfinder. I don't know if it is going to be useful in your case.