function modalframe_close_dialog in Modal Frame API 7
Same name and namespace in other branches
- 6 modalframe.module \modalframe_close_dialog()
API: Close a client side dialog.
This function should be used on form submit handlers to trigger the action that will close the modal frame on the client side.
Parameters
$args: An optional array of arguments that will be forwarded to the client side onSubmit callback.
2 calls to modalframe_close_dialog()
- modalframe_example_form_submit in modules/
modalframe_example/ modalframe_example.module - Submit handler for our node edit form example.
- modalframe_example_simple_form_submit in modules/
modalframe_example/ modalframe_example.module - Submit handler for the child form.
File
- ./
modalframe.module, line 311 - Provides an API to render an iframe within a modal dialog based on the jQuery UI Dialog plugin.
Code
function modalframe_close_dialog($args = NULL) {
// Make sure this action is not processed more than once.
if (isset($GLOBALS['modalframe_close_dialog'])) {
return;
}
// Build the javascript settings that will close the modal frame on the
// client side.
$child_js_settings = array(
'closeModal' => 1,
'statusMessages' => theme('status_messages'),
'args' => isset($args) && is_array($args) ? $args : array(),
);
drupal_add_js(array(
'modalFrameChild' => $child_js_settings,
), 'setting');
// Tell Drupal's Form API that we are requested to close the modal dialog,
// so we do not wish to perform redirections after submitted form has been
// processed.
$GLOBALS['modalframe_close_dialog'] = TRUE;
}