Drupal Association members fund grants that make connections all over the world.
This module provides an API to render an iframe within a modal dialog based on the jQuery UI Dialog plugin. You should not install this module unless another module requires you to, or you wish to use it for your own custom modules.
It is an alternative to Popups API (Ajax Dialogs) which implements its own library and API to manage popup dialogs. On the other hand, the Modal Frame API is based on the jQuery UI Dialog plugin and it is specially built to deal with iframe elements with very little effort (and no particular AJAX requirements).
For themers, this module provides a default template for rendering child pages within modal frames (modalframe-page.tpl.php) that can be copied to the theme directory and customized to suit the particular needs of the site. It is also pretty easy to adapt the provided stylesheets to match the look of the site.
Highly recommended: onBeforeUnload API (enhances synchronization of parent/child windows). See reference: .
Builtin support for: Dirty Forms.
Modules using Modal Frame API: Modal Frame Contrib Package (includes mini-modules that implement the Modal Frame API to enhance the usability of a few day to day tasks in every Drupal site), Node Relationships, Modal Frame CCK Editor, Modal Frames from Menu Items, Subnodes by Taxonomy.
Modal Frame API is pretty simple, but powerful at the same time.
The server-side API looks as follows:
- modalframe_close_dialog($args) - When a form is rendered within a modal frame (what we would call the child window), you can use this function from your form submit handler to close the client-side dialog. You can also give it arguments that will be passed to an optional
onSubmitdialog callback that you can provide when opening the modal frame from the parent window.
The client-side API looks as follows:
- url - Required. The URL of the page you wish to render within the modal frame. Note that this feature is restricted by browser security contexts, so you can only open child pages from the same domain where the parent page is located.
- width and height - Optional. The size in pixels of the dialog.
- autoFit - Optional. Enabled by default. This option activates an onResize handler that will automatically resize and center the modal frame whenever the browser window is resized or when the child document is fully loaded.
- draggable - Optional. Enabled by default.
- onOpen - Optional. This is a callback to invoke when the modal frame is opened.
- onLoad - Optional. This is a callback to invoke when the the child document in the modal frame is fully loaded.
- onSubmit - Optional. A function that will be called when the dialog is closed by the server-side response to a form submit request. See
- customDialogOptions - Optional. An object with custom jQuery UI Dialog options.
- There's also a close() method and a few others, but these are used internally. You don't need to care about them. Just open a modal dialog and everything should be fine as long as the server-side menu callback invokes the function
modalframe_child_js()when generating pages for the modal dialog.
The package also contains an optional module that can be used as an example. It is also recommended to check out the inline code documentation as it has a lot of information on how it all works.
How can you get involved?
- Write a review for this module on drupalmodules.com
- Help translate this module at localize.drupal.org
This module has been sponsored by Gamefilia.
- Maintenance status: Minimally maintained
- Development status: Maintenance fixes only
- Reported installs: 3,537 sites currently report using this module. View usage statistics.
- Downloads: 124,458
- Last modified: December 2, 2014
- Stable releases are covered by the security advisory policy.
Look for the shield icon below.