- Patch #659480 by mgifford, David_Rothstein, aaronbauman, Jody Lynn, casey, cwgordon7: added per-user setting for the overlay.
parent
26392c86d0
commit
58a8be92bc
|
@ -57,6 +57,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().
|
||||
*
|
||||
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue