I’m converting an add-on from EE 2 to EE 3. It uses $.ee_filebrowser.add_trigger. As far as I can that still exists but I get a console error:

Uncaught TypeError: Cannot read property 'dialog' of undefined

I can’t quite figure out what to do. I’ve tried to dicipher it in the minified code but I can’t quote figure it out. Can anyone point me in the right direction?

  • I'm also having this issue. did you ever figure out a fix or did you perhaps file this as a bug with EllisLab?
    – Ben Croker
    Jan 20, 2016 at 10:54
  • I had to stop working on the add-on I was working on so I never did figure it out. I’ll be returning to that add-on in the next couple of weeks so if it’s still an issue, hopefully we can get it sorted out.
    – TJ Draper
    Jan 20, 2016 at 14:53

1 Answer 1


Had time to circle back around to this and finish up my add-on. I don’t think the FilePicker service was documented when I started the question, but it certainly is now:


But I needed to make specific links in my add-on open with a specific directory but I would not necessarily know before hand. I needed to make the FilePicker links available to my template so I could select them based on the upload directory. So I did this:

// Load the FilePicker
$filePicker = ee('CP/FilePicker')->make();

// Class that gets EE's upload directories
$uploadDirectories = new UploadDirectories();

// Add each directories upload link to array
$modalLinks = array();
foreach ($uploadDirectories as $dir) {
    $modalLinks[$dir['id']] = array(
        'link' => $filePicker->setDirectories($dir['id'])
            ->setAttribute('class', 'btn action js-ansel-add-image')
        'hiddenLink' => $filePicker->setDirectories($dir['id'])
            ->setAttribute('class', 'btn action js-ansel-add-image js-hide')

I make that available to my template. Now I can select the correct button from the array based on the directory ID.

Then on the Javascript side:

    callback: function(file, references) {
        // Close the modal

        // Do stuff

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.