Top
craft-uikit
craft-widget-

ModalViewController

ModalViewController

ViewController for Modal.

If you put full page content,
you have to set content background color by yourself to fill the safe area.

modalViewController.setContent(modal_page);
modalViewController.content.style['background-color'] = '#fff';

Constructor

new ModalViewController()

Source:

ModalViewController Constructor

You can customize modal behaviour via this.MaskConfig and this.AnimationConfig.
See the code if needed.

Example
const modalViewController = new Craft.UI.ModalViewController();
modalViewController.loadView();

const dialog = new Dialog({
    closeHandler : () => {
        modalViewController.hideContent( () => {
            dialog.unloadView();
            modalViewController.unloadView();
        });
    }
});
dialog.loadView();

modalViewController.setContent(dialog);

Craft.Core.Context.getRootViewController().appendView(modalViewController);
modalViewController.showContent();

Classes

ModalViewController

Methods

viewDidLoad(callback)

Source:

override viewDidLoad:

Parameters:
Name Type Description
callback function

callback

setContent(component)

Source:

Set modal content

Parameters:
Name Type Description
component Craft.Core.Component

component

showMask(callback)

Source:

Show mask

Parameters:
Name Type Description
callback function

callback

hideMask(callback)

Source:

Hide mask

Parameters:
Name Type Description
callback function

callback

showContent(callback)

Source:

Show modal content

Parameters:
Name Type Description
callback function

callback

hideContent(callback)

Source:

Hide modal content

Parameters:
Name Type Description
callback function

callback

(protected) style()

Source:

style

(protected) template()

Source:

template