Changes to support a fixed position (i.e. does not scroll with the page.)
Put the menu inside a <div> block (so fixed position works.) Added support to switch between versions of superfish. Added support for z-index parameter in admin screen.
This commit is contained in:
@@ -58,6 +58,19 @@ function simplemenu_admin_settings() {
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
|
||||
$fix_options = array(
|
||||
'scroll' => t('Scroll with page'),
|
||||
'top' => t('Fix at the Top (Forces Body, Prepend)'),
|
||||
//'bottom' => t('Fix at the Bottom (Forces Body, Append)'), -- this requires another CSS... hmmm...
|
||||
);
|
||||
$form['settings']['simplemenu_fix'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Scroll or fix menu'),
|
||||
'#options' => $fix_options,
|
||||
'#default_value' => variable_get('simplemenu_fix', 'scroll'),
|
||||
'#description' => t('Select the mode to use. The default is to let the menu scroll with the page.<br /><span style="color: red;">WARNING:</span> The At the Top/Bottom options prevent you from ever seeing the bottom of your drop-down menus. In other words, if you have many modules installed, it is not unlikely that your <em>Site configuration</em> menu will not fit the screen and the last few entries won\'t be accessible via Simplemenu.'),
|
||||
);
|
||||
|
||||
$form['settings']['simplemenu_hide_delay'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Hide delay'),
|
||||
@@ -66,17 +79,6 @@ function simplemenu_admin_settings() {
|
||||
'#description' => t('How long (in milliseconds) should a menu still appear after losing focus.'),
|
||||
);
|
||||
|
||||
$form['settings']['simplemenu_scroll_effect'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Scroll effect'),
|
||||
'#options' => array(
|
||||
'scroll' => t('Scroll with the page'),
|
||||
'fixed' => t('Fixed'),
|
||||
),
|
||||
'#default_value' => variable_get('simplemenu_scroll_effect', 'scroll'),
|
||||
'#description' => t('Whether the menu scrolls with the page or stays at the top or bottom (this should only be used when the menu is attached to the <body> tag.)'),
|
||||
);
|
||||
|
||||
$form['settings']['simplemenu_effect'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Show effect'),
|
||||
@@ -113,6 +115,34 @@ function simplemenu_admin_settings() {
|
||||
'#default_value' => variable_get('simplemenu_uid1', 1),
|
||||
);
|
||||
|
||||
$simplemenu_path = drupal_get_path('module', 'simplemenu');
|
||||
$superfish = file_scan_directory($simplemenu_path, '^superfish-[0-9.]*\.js$',
|
||||
array('.', '..', 'CVS', '.svn'), 0, FALSE, 'basename');
|
||||
foreach ($superfish as $name => $ignore) {
|
||||
$superfish[$name] = $name;
|
||||
}
|
||||
$form['advanced']['simplemenu_superfish_version'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('SuperFish Version'),
|
||||
'#options' => $superfish,
|
||||
'#description' => t('Select which version of SuperFish you prefer using.') .$simplemenu_path,
|
||||
'#default_value' => variable_get('simplemenu_superfish_version', 'superfish-1.4.1.js'),
|
||||
);
|
||||
|
||||
$form['advanced']['simplemenu_menubar_zindex'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Menubar CSS z-index value'),
|
||||
'#description' => t('By default, the menubar CSS z-index is set to 1. Some themes or other modules may require you to change this value. Use -1 to completely disable the z-index in the menubar.'),
|
||||
'#default_value' => variable_get('simplemenu_menubar_zindex', 9999),
|
||||
);
|
||||
|
||||
$form['advanced']['simplemenu_dropdown_zindex'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Dropdown CSS z-index value'),
|
||||
'#description' => t('By default, the dropdown CSS z-index is set to 9999. However, some themes and modules use an even larger z-index. For instance, the AddThis overlay is put at z-index 100,000 (although from my tests, it seems that they use a much higher z-index...). So if you want the Simplemenu to appear over the AddThis pop-up, you want to use a z-index which is even larger (i.e. 2,000,000 [do not enter the commas!].) On the other hand, 9999 may be too large for your site. You can use a smaller number if that works better for you. Use -1 to not remove the z-index from your dropdown.'),
|
||||
'#default_value' => variable_get('simplemenu_dropdown_zindex', 9999),
|
||||
);
|
||||
|
||||
$form['advanced']['simplemenu_element'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('CSS selector to attach menu to'),
|
||||
@@ -127,9 +157,10 @@ function simplemenu_admin_settings() {
|
||||
'#options' => array(
|
||||
'prepend' => t('Prepend'),
|
||||
'append' => t('Append'),
|
||||
'replace' => t('Replace'),
|
||||
),
|
||||
'#default_value' => variable_get('simplemenu_element_method', 'prepend'),
|
||||
'#description' => t('Choose how the menu should be attached to the above selector.'),
|
||||
'#description' => t('Choose how the menu should be attached to the above selector.<br /><span style="color: red;">WARNING:</span> The Replace option should only be used with a specialized theme that offers a tag that is to be replaced by the simple menu. Make sure you don\'t use that option with your body!'),
|
||||
'#required' => TRUE,
|
||||
);
|
||||
|
||||
@@ -145,10 +176,10 @@ function simplemenu_admin_settings() {
|
||||
'#description' => t('Select which themes to <strong>not</strong> display the menu. Use this when you have a theme that displays its own admin navigation.'),
|
||||
);
|
||||
|
||||
$form['advanced']['simplemenu_detect_popop'] = array(
|
||||
$form['advanced']['simplemenu_detect_popup'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Detect pop-up windows'),
|
||||
'#default_value' => variable_get('simplemenu_detect_popop', 1),
|
||||
'#default_value' => variable_get('simplemenu_detect_popup', 1),
|
||||
'#description' => t("Choose whether SimpleMenu should attempt to detect if it is inside of a pop-up window. If enabled, SimpleMenu will not display if it is inside of a pop-up window."),
|
||||
);
|
||||
|
||||
@@ -171,7 +202,28 @@ function simplemenu_admin_settings() {
|
||||
'#wysiwyg' => FALSE,
|
||||
);
|
||||
|
||||
$form['#validate'][] = 'simplemenu_admin_settings_validate';
|
||||
$form['#submit'][] = 'simplemenu_admin_settings_submit';
|
||||
|
||||
return system_settings_form($form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that we have settings that are sensical.
|
||||
*/
|
||||
function simplemenu_admin_settings_validate($form, &$form_state) {
|
||||
$values = &$form_state['values'];
|
||||
if ($values['simplemenu_fix'] != 'scroll' && $values['simplemenu_menubar_zindex'] < 1) {
|
||||
form_set_error('simplemenu_menubar_zindex', t('In order to use a Fix mode, you want to increase the menubar z-index value to 1 or more.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle some special cases.
|
||||
*/
|
||||
function simplemenu_admin_settings_submit($form, $form_state) {
|
||||
// make sure we regenerate the CSS file
|
||||
variable_set('simplemenu_css_filename', '');
|
||||
}
|
||||
|
||||
// vim: ts=2 sw=2 et syntax=php
|
||||
|
||||
Reference in New Issue
Block a user