function site_alert_admin in Site Alert 7
Build the administration form.
This form collects the following values and stores them in the vars table.
@toggle - whether or not an alert is active @severity - Severity of the alert (low or high) @title - The title of the Alert (usually "Alert") @content - Content to display on the homepage @node - The associated Alert Node. The Read More link on the homepage will link to this node
1 string reference to 'site_alert_admin'
- site_alert_menu in ./
site_alert.module - Create the page for and link to the form.
File
- ./
site_alert.module, line 58 - Core functionality for the Site Alert module.
Code
function site_alert_admin() {
$form = array();
$form['site_alert_description'] = array(
'#value' => '<p>Use this page to set an Alert. If the "Turn On Alert" checkbox is checked, a blue or red banner (depending on the Alert Severity) will be displayed on the homepage containing the copy defined here.',
);
$date = time();
$format = 'm-d-Y h:iA';
$form['site_alert_start'] = array(
'#type' => 'date_popup',
'#title' => t('Start date for Alert (Default is now)'),
'#date_format' => $format,
'#date_label_position' => 'within',
'#date_increment' => 15,
'#date_year_range' => '-1:+1',
'#default_value' => variable_get('site_alert_start', $date),
'#date_timezone' => variable_get('date_default_timezone', 0),
);
$form['site_alert_expire'] = array(
'#type' => 'date_popup',
'#title' => t('Expiration date for Alert'),
'#date_format' => $format,
'#date_label_position' => 'within',
'#date_increment' => 15,
'#date_year_range' => '-1:+1',
'#default_value' => variable_get('site_alert_expire', $date),
'#date_timezone' => variable_get('date_default_timezone', 0),
'#required' => TRUE,
'#suffix' => '<div class="site-alert-date-info">' . '<em>' . t("Dates are stored in the site's default timezone, currently %tz", array(
'%tz' => variable_get('date_default_timezone'),
)) . '</em></div>',
);
$form['site_alert_severity'] = array(
'#type' => 'select',
'#title' => 'Severity',
'#options' => array(
'info' => t('Informational Only - Default Blue'),
'low' => t('Low Severity - Default Yellow'),
'high' => t('High Severity - Default Red'),
),
'#default_value' => variable_get('site_alert_severity', 'low'),
'#required' => TRUE,
);
$form['site_alert_timeout'] = array(
'#type' => 'select',
'#title' => t('Timeout'),
'#options' => array(
60 => t('1 minute'),
120 => t('2 minutes'),
300 => t('5 minutes'),
600 => t('10 minutes'),
900 => t('15 minutes'),
1200 => t('20 minutes'),
1800 => t('30 minutes'),
3600 => t('1 hour'),
),
'#default_value' => variable_get('site_alert_timeout', SITE_ALERT_TIMEOUT_DEFAULT),
'#description' => t('Configure how frequently the alert is updated in the user\'s browser.'),
);
$alert = variable_get('site_alert_content');
$form['site_alert_content'] = array(
'#type' => 'textarea',
'#description' => t('Allowed tags are a, strong, and em'),
'#title' => 'Content',
'#default_value' => $alert,
'#required' => TRUE,
'#rows' => 2,
);
return system_settings_form($form, FALSE);
}