nice_menus.admin.inc in Nice Menus 6
Same filename and directory in other branches
Functionality for Nice Menus administration.
File
nice_menus.admin.incView source
<?php
/**
* @file
* Functionality for Nice Menus administration.
*/
/**
* Settings form as implemented by hook_menu
*/
function nice_menus_admin_settings() {
$form['nice_menus_number'] = array(
'#type' => 'textfield',
'#description' => t('The total number of independent Nice menus blocks you want. Enter a number between 0 and 99. If you set this to 0, you will have no blocks created but you can still use the Nice menus theme functions directly in your theme.'),
'#default_value' => variable_get('nice_menus_number', '2'),
'#size' => 2,
);
$form['nice_menus_ie'] = array(
'#type' => 'checkbox',
'#title' => t('Enable IE support'),
'#description' => t('This will add necessary JavaScript for Nice Menus to work properly in Internet Explorer.'),
'#default_value' => variable_get('nice_menus_ie', 1),
);
// Custom validation to make sure the user is entering numbers.
$form['#validate'][] = 'nice_menus_settings_validate';
return system_settings_form($form);
}
/**
* Custom validation for the settings form.
*/
function nice_menus_settings_validate($form, &$form_state) {
$number = $form_state['values']['nice_menus_number'];
// Check to make sure it is a number and that is a maximum of 2 digits.
if (!is_numeric($number) || strlen($number) > 2) {
form_set_error('nice_menus_number', t('You must enter a number from 0 to 99.'));
}
}
Functions
Name | Description |
---|---|
nice_menus_admin_settings | Settings form as implemented by hook_menu |
nice_menus_settings_validate | Custom validation for the settings form. |