You are here

function theme_monolog_handler_table in Monolog 7

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

Returns HTML for the handler table.

Parameters

array $variables: An associative array containing:

  • element: The FAPI element being themed.
1 theme call to theme_monolog_handler_table()
monolog_profile_form in ./monolog.admin.inc
Form for adding and editing logging profile configurations.

File

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

Code

function theme_monolog_handler_table(array $variables) {
  $output = '';
  $header = array(
    t('Label'),
    t('Handler'),
    t('Log Level'),
    t('Bubble Messages'),
    t('Weight'),
    t('Operations'),
  );
  $handler_info = $variables['element']['#monolog']['handler_info'];
  $level_options = monolog_level_options();
  $profile = $variables['element']['#monolog']['profile'];
  $rows = array();
  foreach ($profile->options['handlers'] as $name => $handler) {
    $base_path = 'admin/config/development/monolog/profile/' . $profile->name . '/handler/' . $name;
    if (!isset($handler_info[$handler['handler']])) {
      $handler_info[$handler['handler']] = array(
        'label' => $handler['handler'],
      );
    }
    $row = array(
      'label' => check_plain($handler['label']),
      'handler' => check_plain($handler_info[$handler['handler']]['label']),
      'level' => drupal_render($variables['element']['level'][$name]),
      'bubble' => drupal_render($variables['element']['bubble'][$name]),
      'weight' => drupal_render($variables['element']['weight'][$name]),
    );
    $operations = array();
    $operations[] = array(
      'title' => t('Edit'),
      'href' => $base_path . '/edit',
    );
    $operations[] = array(
      'title' => t('Delete'),
      'href' => $base_path . '/delete',
    );
    $row['operations'] = array(
      'data' => array(
        '#theme' => 'links__node_operations',
        '#links' => $operations,
        '#attributes' => array(
          'class' => array(
            'links',
            'inline',
          ),
        ),
      ),
    );
    $rows[$name] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  drupal_add_tabledrag('monolog-handler-table', 'order', 'sibling', 'monolog-handler-weight');
  $output .= drupal_render_children($variables['element']);
  $output .= theme('table', array(
    'caption' => t('Logging Handlers'),
    'header' => $header,
    'rows' => $rows,
    'empty' => t('This profile has no handlers. Add one by clicking the "Add handler" link above.'),
    'attributes' => array(
      'id' => 'monolog-handler-table',
    ),
  ));
  return $output;
}