2

Is there a way to override Garnish.Modal?

For example, I have a custom modal which uses a custom form but I want to be able to use the built in forms.elementSelect to select from a user list. When I select a user and press "select" it closes both my custom modal and my user select window.

Can I override this to just close the most recent modal?

This is in reference to Custom Modals inside Plugins: How can my plugin generate a generic modal window in the Control Panel?

Edit: It looks as if Garnish hides any other modals before loading a new one.

1 Answer 1

1

By default, Garnish.Modal will automatically close other modals when show() is called (which happens automatically when you first create it).

That behavior can be overridden by setting the closeOtherModals setting to false, though:

var myModal = new Garnish.Modal($container, {
    closeOtherModals: false
});
1
  • Thanks, problem is the forms.elementSelect (users) window is the one causing the conflict. I open my window, click add user and it opens the user select window and hides my orignal. So when I close user select, my 1st window is gone. For now I'll probably just move this to another template and not to a modal. Commented Aug 13, 2014 at 15:33

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.