function menutree_settings in MenuTree 5
Same name and namespace in other branches
- 6 menutree.admin.inc \menutree_settings()
Form builder; Display menutree settings form.
1 string reference to 'menutree_settings'
- menutree_menu in ./
menutree.module - Implementation of hook_menu().
File
- ./
menutree.module, line 71 - This module provides a simple "site map" tree based on the menu system rather than on taxonomies.
Code
function menutree_settings() {
$form = array();
$form['menutree'] = array(
'#tree' => FALSE,
);
// This really should be array_combine, but that's not PHP 4 compatible.
$items = array_merge(array(
'<none>',
), range(-10, 10));
$weights = array();
foreach ($items as $item) {
$weights[$item] = $item;
}
$menus = menu_get_root_menus();
foreach ($menus as $mid => $menu) {
$open = trim(variable_get('menutree_title_' . $mid, '') . variable_get('menutree_intro_text_' . $mid, ''));
$form['menutree'][$mid] = array(
'#type' => 'fieldset',
'#title' => $menu,
'#collapsible' => TRUE,
'#collapsed' => $open ? FALSE : TRUE,
'#description' => t('The path <a href="@link">@path</a> will provide a complete tree of all menu items in this menu. If you wish to set a custom title or header text, do so here.', array(
'@link' => url('menutree/' . $mid),
'@path' => 'menutree/' . $mid,
)),
);
$form['menutree'][$mid]['menutree_title_' . $mid] = array(
'#type' => 'textfield',
'#title' => t('Page title'),
'#default_value' => variable_get('menutree_title_' . $mid, ''),
'#description' => t('A page title that is displayed instead of the root menu item title.'),
);
$form['menutree'][$mid]['menutree_intro_text_' . $mid] = array(
'#type' => 'textarea',
'#title' => t('Intro text'),
'#default_value' => variable_get('menutree_intro_text_' . $mid, ''),
'#resizable' => TRUE,
'#description' => t('An intro text that is displayed below the page title.'),
);
$form['menutree'][$mid]['menutree_all_weight_' . $mid] = array(
'#type' => 'select',
'#title' => t('Order in main index'),
'#options' => $weights,
'#default_value' => variable_get('menutree_all_weight_' . $mid, '<none>'),
'#description' => t('The path <a href="@link">@path</a> will provide multiple menu trees on a single page. You can specify which and in what order here. Set the weight to "<none>" to exclude this menu.', array(
'@link' => url('menutree/all'),
'@path' => 'menutree/all',
)),
);
}
return system_settings_form($form);
}