commit bf092dd6a5c9ba28592727dceb499a7cf5c8fac6 Author: Katherine Senzee Date: Mon Oct 26 12:09:42 2009 -0700 D4 / 615114: rename overlay_mode() to overlay_get/set_mode() diff --git modules/overlay/overlay.module modules/overlay/overlay.module index 24e2aa9..2722dd2 100644 --- modules/overlay/overlay.module +++ modules/overlay/overlay.module @@ -33,7 +33,7 @@ function overlay_page_alter(&$page) { * Determine whether the current page request is destined to appear in the * parent window or in the overlay window, and format the page accordingly. * - * @see overlay_mode() + * @see overlay_set_mode() */ function overlay_init() { // @todo: custom_theme does not exist anymore. @@ -51,11 +51,11 @@ function overlay_init() { $custom_theme = $admin_theme; drupal_add_css(drupal_get_path('module', 'system') . '/admin.css'); } - overlay_mode('child'); + overlay_set_mode('child'); } else { // Otherwise add overlay parent code and our behavior. - overlay_mode('parent'); + overlay_set_mode('parent'); // Special case for when overlay.module was just enabled; redirect to // the homepage and reopen the modules page inside the overlay. if (isset($_SESSION['overlay_just_enabled'])) { @@ -124,10 +124,10 @@ function overlay_library() { * If the current page request is inside the overlay, add ?render=overlay to * the new path, so that it appears correctly inside the overlay. * - * @see overlay_mode() + * @see overlay_get_mode() */ function overlay_drupal_goto_alter(&$path, &$options, &$http_response_code) { - if (overlay_mode() == 'child') { + if (overlay_get_mode() == 'child') { if (isset($options['query'])) { $options['query'] += array('render' => 'overlay'); } @@ -143,10 +143,10 @@ function overlay_drupal_goto_alter(&$path, &$options, &$http_response_code) { * If the current page request is inside the overlay, add ?render=overlay to * the success callback URL, so that it appears correctly within the overlay. * - * @see overlay_mode() + * @see overlay_get_mode() */ function overlay_batch_alter(&$batch) { - if (overlay_mode() == 'child') { + if (overlay_get_mode() == 'child') { if (isset($batch['url_options']['query'])) { $batch['url_options']['query']['render'] = 'overlay'; } @@ -162,13 +162,13 @@ function overlay_batch_alter(&$batch) { * If the current page request is inside the overlay, don't display extraneous * blocks. * - * @see overlay_mode() + * @see overlay_get_mode() */ function overlay_block_info_alter(&$blocks) { // @todo: custom_theme does not exist anymore. global $custom_theme; - if (!empty($custom_theme) && overlay_mode() == 'child') { + if (!empty($custom_theme) && overlay_get_mode() == 'child') { $themes = list_themes(); $theme = $themes[$custom_theme]; if (!empty($theme->info['overlay_regions'])) { @@ -199,10 +199,10 @@ function overlay_system_info_alter(&$info, $file) { * If the current page request is inside the overlay, add appropriate classes * to the element, and simplify the page title. * - * @see overlay_mode() + * @see overlay_get_mode() */ function overlay_preprocess_html(&$variables) { - if (overlay_mode() == 'child') { + if (overlay_get_mode() == 'child') { // Add overlay class, so themes can react to being displayed in the overlay. $variables['classes_array'][] = 'overlay'; // Do not include site name or slogan in the overlay title. @@ -215,10 +215,10 @@ function overlay_preprocess_html(&$variables) { * * Display breadcrumbs correctly inside the overlay. * - * @see overlay_mode() + * @see overlay_get_mode() */ function overlay_preprocess_page(&$variables) { - if (overlay_mode() == 'child') { + if (overlay_get_mode() == 'child') { // Remove 'Home' from the breadcrumbs. $overlay_breadcrumb = drupal_get_breadcrumb(); array_shift($overlay_breadcrumb); @@ -285,7 +285,7 @@ function overlay_form_after_build($form, &$form_state) { * we need to output the JavaScript that will tell the parent window to close * the child dialog. * - * @see overlay_mode() + * @see overlay_get_mode() * @ingroup forms */ function overlay_form_submit($form, &$form_state) { @@ -299,13 +299,13 @@ function overlay_form_submit($form, &$form_state) { // Wait until $form_state['redirect'] has a value (which is not until the // submit button handler has been called), so that we have somewhere // to redirect to. - if ($args === FALSE && overlay_mode() == 'child' && !empty($form['#node_edit_form']) && isset($form_state['redirect']) && $form_state['clicked_button']['#value'] !== t('Delete')) { + if ($args === FALSE && overlay_get_mode() == 'child' && !empty($form['#node_edit_form']) && isset($form_state['redirect']) && $form_state['clicked_button']['#value'] !== t('Delete')) { $args = overlay_close_dialog(TRUE); } // Make sure the overlay is closed when the node delete form has been // confirmed. - if ($args === FALSE && overlay_mode() == 'child' && $form['#form_id'] === 'node_delete_confirm') { + if ($args === FALSE && overlay_get_mode() == 'child' && $form['#form_id'] === 'node_delete_confirm') { $args = overlay_close_dialog(TRUE); } @@ -342,6 +342,15 @@ function overlay_form_submit($form, &$form_state) { } /** + * Get the current overlay mode. + * + * @see overlay_set_mode() + */ +function overlay_get_mode() { + return overlay_set_mode(NULL); +} + +/** * Set overlay mode and add proper JavaScript and styles to the page. * * @param $mode @@ -358,7 +367,7 @@ function overlay_form_submit($form, &$form_state) { * The current mode, if any has been set, or NULL if no mode has been set. * @ingroup overlay_api */ -function overlay_mode($mode = NULL) { +function overlay_set_mode($mode = NULL) { global $base_path; $overlay_mode = &drupal_static(__FUNCTION__);