You are here

function monolog_handler_page in Monolog 6

Same name and namespace in other branches
  1. 7 monolog.admin.inc \monolog_handler_page()

Page callback; Lists the handlers than can be added.

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

File

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

Code

function monolog_handler_page($profile) {
  $build = array();
  $grouped_handlers = array();
  composer_manager_register_autoloader();
  $handlers = monolog_handler_info_load_all();
  foreach ($handlers as $handler_name => $handler_info) {
    $grouped_handlers[$handler_info['group']][$handler_name] = $handler_info;
  }
  $base_path = 'admin/config/development/monolog/profile/' . $profile->name;
  $breadcrumb = drupal_get_breadcrumb();
  $breadcrumb[] = l($profile->options['label'], $base_path);
  drupal_set_breadcrumb($breadcrumb);

  // @todo Theme function.
  $output = '<dl>';
  foreach ($grouped_handlers as $group => $handlers) {
    $output .= '<h3>' . check_plain($group) . '</h3>';
    foreach ($handlers as $handler_name => $handler_info) {
      $path = $base_path . '/handler/add/' . $handler_name;
      $output .= '<dt>' . l($handler_info['label'], $path) . '</dt>';
      $output .= '<dd>' . filter_xss_admin($handler_info['description']) . '</dd>';
    }
  }
  $output .= '</dl>';
  $build['handlers'] = array(
    '#markup' => $output,
  );
  $build['cancel'] = array(
    '#markup' => l(t('Go back to profile edit page'), $base_path),
  );
  return $build;
}