You are here

function overlay_paths_overlay_parent_initialize in Overlay Paths 7

Implements hook_overlay_parent_initialize().

Replaces overlay's implementation, which adds settings for admin paths, but will include those explicitly excluded from using the overlay.

File

./overlay_paths.module, line 159
The overlay paths module.

Code

function overlay_paths_overlay_parent_initialize() {

  // Let the client side know which paths are to be used in the overlay.
  $paths = path_get_admin_paths();
  $paths['non_admin'] = overlay_paths_get_overlay_patterns(FALSE);
  foreach ($paths as $k => $type) {
    $paths[$k] = str_replace('<front>', variable_get('site_frontpage', 'node'), $type);
  }
  drupal_add_js(array(
    'overlay' => array(
      'paths' => $paths,
    ),
  ), 'setting');
  $path_prefixes = array();
  if (module_exists('locale') && variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX) == LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX) {

    // Get languages grouped by status and select only the enabled ones.
    $languages = language_list('enabled');
    $languages = $languages[1];
    $path_prefixes = array();
    foreach ($languages as $language) {
      if ($language->prefix) {
        $path_prefixes[] = $language->prefix;
      }
    }
  }
  drupal_add_js(array(
    'overlay' => array(
      'pathPrefixes' => $path_prefixes,
    ),
  ), 'setting');

  // Pass along the Ajax callback for rerendering sections of the parent window.
  drupal_add_js(array(
    'overlay' => array(
      'ajaxCallback' => 'overlay-ajax',
    ),
  ), 'setting');
}