3

The forum topics list has this in the table header: Topic, Replies, Created, Last Reply. I just want to remove the Created heading.

Template file forum-topic-list.tpl.php prints the table header with <?php print $header; ?>

The template file documentation explains that:

$header is pre-generated with click-sorting information. If you need to change this, @see template_preprocess_forum_topic_list() @see theme_forum_topic_list().

So I dig around in forum.module and find template_preprocess_forum_topic_list(). This function appears to prepare the variables for the header, but doesn't create the HTML for the output.
I look up the other function that was referenced, theme_forum_topic_list().

The API documentation reports the following:

This function is never used; see the corresponding template file instead."

What am I missing here?

0

1 Answer 1

2

template_preprocess_forum_topic_list() initializes the variable with the value returned from _theme_table_cell().

global $forum_topic_list_header;

// Create the tablesorting header.
$ts = tablesort_init($forum_topic_list_header);
$header = '';
foreach ($forum_topic_list_header as $cell) {
  $cell = tablesort_header($cell, $forum_topic_list_header, $ts);
  $header .= _theme_table_cell($cell, TRUE);
}
$variables['header'] = $header;

 

function _theme_table_cell($cell, $header = FALSE) {
  $attributes = '';

  if (is_array($cell)) {
    $data = isset($cell['data']) ? $cell['data'] : '';
    $header |= isset($cell['header']);
    unset($cell['data']);
    unset($cell['header']);
    $attributes = drupal_attributes($cell);
  }
  else {
    $data = $cell;
  }

  if ($header) {
    $output = "<th$attributes>$data</th>";
  }
  else {
    $output = "<td$attributes>$data</td>";
  }

  return $output;
}

The variable $variables['header'] in template_preprocess_forum_topic_list() is the same variable that in forum-topic-list.tpl.php is accessed as $header.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.