You are here

function _prod_check_functions_as_form in Production check & Production monitor 6

Same name and namespace in other branches
  1. 7 includes/prod_check.admin.inc \_prod_check_functions_as_form()

Parse the functions array and return a form fieldset with different sets of checkboxes so it can be inserted 'as is' in another form array for rendering. This is primlarily still here for integration with Nagios. Though not in use now since Nagios would create far too much needless variables in my personal opinion. It's left in for easy future integration with the hook_nagios_settings().

1 call to _prod_check_functions_as_form()
prod_check_settings_form in includes/prod_check.admin.inc
Build settings form.

File

includes/prod_check.admin.inc, line 302

Code

function _prod_check_functions_as_form($compatibility = 'all') {
  $form = array();
  $form['prod_check_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Configure what data you wish to monitor with <strong>Nagios</strong> for this site.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['prod_check_settings']['monitor_settings'] = array(
    '#type' => 'markup',
    '#prefix' => '<div id="prod-check-settings">',
    '#suffix' => '</div>',
    '#tree' => TRUE,
  );
  $i = 1;
  $functions = _prod_check_functions();
  if ($compatibility == 'all') {
    unset($functions['prod_mon']);
    unset($functions['perf_data']);
  }
  foreach ($functions as $set => $data) {
    $rest = $i % 2;
    $form['prod_check_settings']['monitor_settings'][$set] = array(
      '#type' => 'checkboxes',
      '#title' => t($data['title']),
      '#description' => t($data['description']),
      '#options' => $data['functions'],
      '#default_value' => array_keys($data['functions']),
      '#prefix' => '<div class="prod-check-settings ' . ($rest ? 'odd' : 'even') . '">',
      '#suffix' => '</div>',
    );
    $i++;
  }
  return $form;
}