You are here

function modalframe_child_js in Modal Frame API 6

Same name and namespace in other branches
  1. 7 modalframe.module \modalframe_child_js()

API: Add javascript and stylesheets to the child page.

3 calls to modalframe_child_js()
modalframe_example_hello_world in modules/modalframe_example/modalframe_example.module
Menu callback; Hello world example.
modalframe_example_node_edit_page in modules/modalframe_example/modalframe_example.module
Menu callback; Node edit form example.
modalframe_example_simple_form in modules/modalframe_example/modalframe_example.module
Generate the form for the child window.

File

./modalframe.module, line 236
Provides an API to render an iframe within a modal dialog based on the jQuery UI Dialog plugin.

Code

function modalframe_child_js() {
  static $processed;

  // Make sure external resources are not included more than once.
  if (isset($processed)) {
    return;
  }
  $processed = TRUE;

  // Disable admin_menu, admin module output and similar modules, which
  // is something child windows don't need.
  module_invoke_all('suppress');

  // This is required to get access to jQuery UI extensions to jQuery itself,
  // such as the ':focusable' and ':tabbable' selectors.
  jquery_ui_add(array(
    'ui.core',
  ));

  // Add javascript and stylesheets to the child page.
  $module_path = drupal_get_path('module', 'modalframe');
  drupal_add_css($module_path . '/css/modalframe.child.css');
  drupal_add_js($module_path . '/js/child.js');
  if (module_exists('onbeforeunload')) {
    onbeforeunload_add_js();
  }

  // Tell Drupal's theme system to use the Modal Frame template.
  $GLOBALS['modalframe_page_template'] = TRUE;
}