You are here

function monolog_channel_form in Monolog 7

Same name and namespace in other branches
  1. 6 monolog.admin.inc \monolog_channel_form()

Channel settings for the Monolog module.

1 string reference to 'monolog_channel_form'
monolog_menu in ./monolog.module
Implements hook_menu().

File

./monolog.admin.inc, line 66
Administrative settings for the Monolog module.

Code

function monolog_channel_form($form, &$form_state) {
  $channel_info = monolog_channel_info_load_all();
  $channel_profiles = variable_get('monolog_channel_profiles', array());
  $form['description'] = array(
    '#markup' => t('<p>A <strong>channel</strong> identifies which part of the application a record is related to.</p><p>Each channel is associated with a <a href="@href">profile</a> that defines which handlers are used to process the record, for example a <em>syslog handler</em> or <em>stream wrapper handler</em>.</p>', array(
      '@href' => url('admin/config/development/monolog/profile'),
    )),
  );
  $form['channel_table'] = array(
    '#theme' => 'monolog_channel_table',
    '#tree' => TRUE,
    'channel_info' => array(
      '#type' => 'value',
      '#value' => $channel_info,
    ),
    'channels' => array(),
  );
  foreach ($channel_info as $channel_name => $info) {
    if (!isset($channel_profiles[$channel_name])) {
      $channel_profiles[$channel_name] = $info['default profile'];
    }
    $form['channel_table']['channels'][$channel_name]['profile'] = array(
      '#type' => 'select',
      '#options' => monolog_profile_options(),
      '#default_value' => $channel_profiles[$channel_name],
    );
  }
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save channel settings'),
  );
  $form['#submit'] = array(
    'monolog_channel_form_submit',
  );
  return $form;
}