summaryrefslogtreecommitdiff
path: root/modules/overlay
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-07-28 02:50:00 +0000
committerDries Buytaert <dries@buytaert.net>2010-07-28 02:50:00 +0000
commit58a8be92bc8fe2dd5316810ba92d3a8f8cdb1f33 (patch)
treeb0dcad27c5c82bc0e1a554aa3731b94a55bc5fb8 /modules/overlay
parent26392c86d0694b372c8a3374fe152eed64aebfed (diff)
downloadbrdo-58a8be92bc8fe2dd5316810ba92d3a8f8cdb1f33.tar.gz
brdo-58a8be92bc8fe2dd5316810ba92d3a8f8cdb1f33.tar.bz2
- Patch #659480 by mgifford, David_Rothstein, aaronbauman, Jody Lynn, casey, cwgordon7: added per-user setting for the overlay.
Diffstat (limited to 'modules/overlay')
-rw-r--r--modules/overlay/overlay.module38
1 files changed, 37 insertions, 1 deletions
diff --git a/modules/overlay/overlay.module b/modules/overlay/overlay.module
index 13e32f1b6..5537ddf0e 100644
--- a/modules/overlay/overlay.module
+++ b/modules/overlay/overlay.module
@@ -58,6 +58,39 @@ function overlay_theme() {
}
/**
+ * Implements hook_form_FORM_ID_alter().
+ */
+function overlay_form_user_profile_form_alter(&$form, &$form_state) {
+ if ($form['#user_category'] == 'account') {
+ $account = $form['#user'];
+ if (user_access('access overlay', $account)) {
+ $form['overlay_control'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Administrative overlay'),
+ '#weight' => 4,
+ '#collapsible' => TRUE,
+ );
+
+ $form['overlay_control']['overlay'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Use the overlay for administrative pages.'),
+ '#description' => t('Show administrative pages on top of the page you started from.'),
+ '#default_value' => isset($account->data['overlay']) ? $account->data['overlay'] : 1,
+ );
+ }
+ }
+}
+
+/**
+ * Implements hook_user_presave().
+ */
+function overlay_user_presave(&$edit, $account, $category) {
+ if (isset($edit['overlay'])) {
+ $edit['data']['overlay'] = $edit['overlay'];
+ }
+}
+
+/**
* Implements hook_init().
*
* Determine whether the current page request is destined to appear in the
@@ -66,11 +99,14 @@ function overlay_theme() {
* @see overlay_set_mode()
*/
function overlay_init() {
+ global $user;
+
$mode = overlay_get_mode();
// Only act if the user has access to the overlay and a mode was not already
// set. Other modules can also enable the overlay directly for other uses.
- if (empty($mode) && user_access('access overlay')) {
+ $use_overlay = !isset($user->data['overlay']) || $user->data['overlay'];
+ if (empty($mode) && user_access('access overlay') && $use_overlay) {
$current_path = current_path();
// After overlay is enabled on the modules page, redirect to
// <front>#overlay=admin/modules to actually enable the overlay.