#114015, advanced menu settings to place menu anywhere on page, patch by Steve McKenzie, modified by me

This commit is contained in:
Ted Serbinski
2007-01-30 05:41:41 +00:00
parent a5022b38fc
commit 6085946d1d
2 changed files with 51 additions and 8 deletions

View File

@@ -33,11 +33,17 @@ function simplemenu_menu($may_cache) {
// We put this in !$may_cache so it's only added once per request
elseif (user_access('view simplemenu')) {
$path = drupal_get_path('module', 'simplemenu');
drupal_add_css($path .'/simplemenu.css');
// pass in base path to the JS file
// url() handles appending ?q= but in this case, we need to pass in the variable so the menus work when mod_rewrite is off
drupal_add_js(array('simplemenu' => array('basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='))), 'setting');
drupal_add_css($path .'/simplemenu.css');
$settings = array(
// pass in base path to the JS file
// url() handles appending ?q= but in this case, we need to pass in the variable so the menus work when mod_rewrite is off
'basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='),
'placement' => variable_get('simplemenu_element_method', 'prepend'),
'element' => variable_get('simplemenu_element', 'body')
);
drupal_add_js(array('simplemenu' => $settings), 'setting');
drupal_add_js($path .'/simplemenu.js');
}
@@ -68,6 +74,30 @@ function simplemenu_admin_settings() {
'#title' => t('Add devel module links'),
'#default_value' => variable_get('simplemenu_devel', 0),
'#description' => t('Add devel module links for those users that can access the devel module.')
);
$form['default_menu']['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE
);
$form['default_menu']['advanced']['simplemenu_element'] = array(
'#type' => 'textfield',
'#title' => t('CSS selector to attach menu to'),
'#default_value' => variable_get('simplemenu_element', 'body'),
'#description' => t('A valid CSS selector to attach the menu to. <em>Example: body, #primary, div.my-class</em>'),
'#required' => TRUE
);
$form['default_menu']['advanced']['simplemenu_element_method'] = array(
'#type' => 'radios',
'#title' => 'Attach method',
'#options' => drupal_map_assoc(array('prepend', 'append', 'replace')),
'#default_value' => variable_get('simplemenu_element_method', 'prepend'),
'#description' => t('Choose how the menu should be attached to the above selector.'),
'#required' => TRUE
);
return system_settings_form($form);