You are here

function overlay_overlay_child_initialize in Drupal 7

Implements hook_overlay_child_initialize().

File

modules/overlay/overlay.module, line 699
Displays the Drupal administration interface in an overlay.

Code

function overlay_overlay_child_initialize() {

  // Check if the parent window needs to refresh any page regions on this page
  // request.
  overlay_trigger_refresh();

  // If this is a POST request, or a GET request with a token parameter, we
  // have an indication that something in the supplemental regions of the
  // overlay might change during the current page request. We therefore store
  // the initial rendered content of those regions here, so that we can compare
  // it to the same content rendered in overlay_exit(), at the end of the page
  // request. This allows us to check if anything actually did change, and, if
  // so, trigger an immediate Ajax refresh of the parent window.
  if (!empty($_POST) || isset($_GET['token'])) {
    foreach (overlay_supplemental_regions() as $region) {
      overlay_store_rendered_content($region, overlay_render_region($region));
    }

    // In addition, notify the parent window that when the overlay closes,
    // the entire parent window should be refreshed.
    overlay_request_page_refresh();
  }

  // Indicate that when the main page rendering occurs later in the page
  // request, only the regions that appear within the overlay should be
  // rendered.
  overlay_set_regions_to_render(overlay_regions());
}