You are here

function health_admin_settings_form in Health Status 7

Admin settings form.

1 string reference to 'health_admin_settings_form'
health_menu in ./health.module
Implements hook_menu().

File

./health.admin.inc, line 10
Contains admin forms.

Code

function health_admin_settings_form($form, &$form_state) {
  $form['email'] = array(
    '#type' => 'fieldset',
    '#title' => t('E-mail settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['email']['health_email_threshold'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Get e-mails if health status is:'),
    '#options' => array(
      HEALTH_OKAY => t('Okay'),
      HEALTH_UNKNOWN => t('Unknown'),
      HEALTH_WARNING => t('Warning'),
      HEALTH_ERROR => t('Error'),
    ),
    '#default_value' => variable_get('health_email_threshold', array()),
  );
  $form['email']['health_email_frequency'] = array(
    '#type' => 'select',
    '#title' => t('E-mail sending frequency'),
    '#options' => array(
      'never' => t('Never'),
      3600 * 24 * 7 => t('Once a week'),
      3600 * 24 * 1 => t('Once per day'),
      3600 * 12 => t('Twice a day'),
      3600 => t('Hourly'),
      'cron' => t('Every cron run'),
    ),
    '#description' => t('The speed e-mails are sent depends on how often cron runs.'),
    '#default_value' => variable_get('health_email_frequency', 'never'),
  );
  $form['email']['health_email_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Health e-mail subject'),
    '#default_value' => variable_get('health_email_subject'),
  );
  $form['email']['health_email_users'] = array(
    '#type' => 'textarea',
    '#title' => t('Send health status e-mails to:'),
    '#description' => t('Enter each e-mail on a new line.'),
    '#default_value' => variable_get('health_email_users'),
  );
  $form['api'] = array(
    '#type' => 'fieldset',
    '#title' => t('API settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['api']['health_api_require_https'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require HTTPS (recommended)'),
    '#description' => t('This will ensure that all API requests are secure.'),
    '#default_value' => variable_get('health_api_require_https'),
  );
  $form['api']['health_api_access_key'] = array(
    '#type' => 'textfield',
    '#title' => t('API Access key'),
    '#description' => t('Private key that is required to be sent via POST to access the API. !help', array(
      '!help' => l(t("What is this?"), "admin/help/health", array(
        'fragment' => 'api-key',
      )),
    )),
    '#default_value' => variable_get('health_api_access_key'),
  );
  return system_settings_form($form);
}