function brb_admin_settings in Browser Bouncer (brb) 7
The admin settings form
1 string reference to 'brb_admin_settings'
- brb_menu in ./
brb.module - Implementation of hook_menu().
File
- ./
brb.admin.inc, line 12 - Administrative page callbacks for the BrB module.
Code
function brb_admin_settings($form, &$form_state) {
$form = array();
// IE conditional
$form['brb_ie_conditional'] = array(
'#description' => t("The versions of IE you want to block. For more information read ") . l(t('About Conditional Comments'), 'http://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx') . '.',
'#type' => 'textfield',
'#title' => t('Internet Explorer conditional'),
'#default_value' => variable_get('brb_ie_conditional', BRB_IE_CONDITIONAL_DEFAULT),
'#size' => 60,
'#maxlength' => 128,
);
// Overlay option
$form['brb_overlay'] = array(
'#description' => t('Apply an overlay layer to the viewport making the content page no accessible.'),
'#title' => t('Apply overlay layer'),
'#type' => 'checkbox',
'#default_value' => variable_get('brb_overlay', TRUE),
);
// Dialog windows title
$form['brb_title'] = array(
'#description' => t("The title to display on the dialog window."),
'#type' => 'textfield',
'#title' => t('Dialog window title'),
'#default_value' => variable_get('brb_title', BRB_TITLE),
'#size' => 60,
'#maxlength' => 128,
);
// Explanation Message
$form['brb_body'] = array(
'#description' => t('A brief message letting the user know why his/her browser is not supported.'),
'#title' => t('Explanation Message'),
'#type' => 'textarea',
'#default_value' => variable_get('brb_body', BRB_BODY_DEFAULT),
);
// Drag and drop table
$browsers = variable_get('brb_browsers', array());
uasort($browsers, 'brb_cmp');
foreach ($browsers as $i => $browser) {
//create a partial table row containing the data from the table
$data = array(
$browser->name,
);
//add our static "row" data into a form value
$form['rows'][$i]['data'] = array(
'#type' => 'value',
'#value' => $data,
);
//add URL
$form['rows'][$i]['url-' . $i] = array(
'#type' => 'textfield',
'#size' => 60,
'#default_value' => $browser->url,
);
//add exclude flag
$form['rows'][$i]['exclude-' . $i] = array(
'#type' => 'checkbox',
'#default_value' => $browser->exclude,
);
//now create the weight form element.
//NOTE how we add the id into the element key
$form['rows'][$i]['weight-' . $i] = array(
'#type' => 'weight',
'#default_value' => $browser->weight,
);
}
// Let the system module add submit buttons and manage validation
//$form = system_settings_form($form);
//Don't forget the submit buttons
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
$form['buttons']['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset to defaults'),
);
return $form;
}