Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

MatthewRuddy on "Remove new media modal entirely?"

$
0
0

Hi. Is it even possible to do this? I've been using Backbone extensively so I'm well used to it, and yet I can't figure out for the life of me how to completely remove a media modal (wp 3.5+).

The wp.media view contains lots of views, I get that, but simply calling 'remove' should remove the whole lot; the two <div>'s creating a modal creates, the frame itself another with the class '.browser' which I assume is for the file uploader functionality.

Instead, calling 'remove' just remove the inner frame (media-modal-content). Makes little sense to me, who would want to do that? 'close' closes everything, but doesn't destroy it.

I need to destroy as I'm using custom views within my own plugin which has an 'Insert Image' button. Clicking it creates a new media modal. Multiple media modal views in the DOM at one time are causing problems, so I need to make sure only one is within the DOM at a particular. Hence, upon clicking the modal 'X' I'm hacking the function to destroy the modal instead of just closing it (to be reopened if needed in the future).

Why is there no simple function for this? Or am I missing something..


Viewing all articles
Browse latest Browse all 8245

Trending Articles