function _taxonomy_menu_admin in Taxonomy menu 6
Same name and namespace in other branches
- 5 taxonomy_menu.inc \_taxonomy_menu_admin()
Admin area. Configure the module, setting which vocabularies will be converted into menus items
Return value
Array. The form fields.
1 string reference to '_taxonomy_menu_admin'
- _taxonomy_menu_menu in ./
taxonomy_menu.inc - Implementation of hook_menu().
File
- ./
taxonomy_menu.inc, line 18 - @author Jonathan Chaffer <jchaffer@structureinteractive.com> @author Bruno Massa <http://drupal.org/user/67164> taxonomy_menu.inc It Generates menu links for all taxonomy terms
Code
function _taxonomy_menu_admin(&$form_state) {
$options = array(
TAXONOMY_MENU_NONE => t('No'),
TAXONOMY_MENU_NORMAL => t('Normal'),
);
// If the Views module is enabled, add some special
// new features
if (module_exists('views')) {
// Add a new options on Categories
$options[TAXONOMY_MENU_VIEW] = t('Views');
// Now get a list of Views
foreach (views_get_all_views() as $view => $viewdata) {
$views_list[$view] = $viewdata->name;
}
}
// If the Taxonomy Default module is enabled, add some special
// new features
if (module_exists('taxonomy_defaults')) {
$options[TAXONOMY_MENU_DEFAULT_TAX] = t('Module types');
}
// Create some options for each of the vocabularies
foreach (taxonomy_get_vocabularies() as $vocab) {
$form[$vocab->vid] = array(
'#title' => $vocab->name,
'#tree' => FALSE,
'#type' => 'fieldset',
);
$form[$vocab->vid]['taxonomy_menu_show_' . $vocab->vid] = array(
'#default_value' => variable_get('taxonomy_menu_show_' . $vocab->vid, TAXONOMY_MENU_NONE),
'#options' => $options,
'#title' => t('Show this category in menu'),
'#type' => 'radios',
);
// In case of View options selected, select Views
if (module_exists('views')) {
$form[$vocab->vid]['taxonomy_menu_show_views_' . $vocab->vid] = array(
'#default_value' => variable_get('taxonomy_menu_show_views_' . $vocab->vid, ''),
'#options' => $views_list,
'#title' => t('Views available'),
'#type' => 'select',
);
}
}
// General options
$form['taxonomy_menu_display_page'] = array(
'#default_value' => variable_get('taxonomy_menu_display_page', 'category'),
'#description' => t('How should be the first item on the menu? Example: categories/1/2/3, technology/1/2/3'),
'#title' => t('Module page'),
'#type' => 'textfield',
);
$form['taxonomy_menu_display_num'] = array(
'#default_value' => variable_get('taxonomy_menu_display_num', FALSE),
'#description' => t('If checked, number of node per term will be displayed in the menu.'),
'#title' => t('Display number of nodes per terms'),
'#type' => 'checkbox',
);
$form['taxonomy_menu_hide_empty'] = array(
'#default_value' => variable_get('taxonomy_menu_hide_empty', FALSE),
'#description' => t('If checked, only taxonomy terms with members will be shown in the menu.'),
'#title' => t('Hide Empty Terms'),
'#type' => 'checkbox',
);
$form['taxonomy_menu_display_descendants'] = array(
'#default_value' => variable_get('taxonomy_menu_display_descendants', TRUE),
'#description' => t('If checked, then when a term is selected all nodes belonging to subterms are also displayed.'),
'#title' => t('Display descendants'),
'#type' => 'checkbox',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}