You are here

function theme_archive_navigation_node_types in Archive 7

Same name and namespace in other branches
  1. 5 archive.inc \theme_archive_navigation_node_types()
  2. 6 archive.pages.inc \theme_archive_navigation_node_types()
  3. 7.2 archive.pages.inc \theme_archive_navigation_node_types()

Theme the list of node types for the archives.

1 theme call to theme_archive_navigation_node_types()
theme_archive_navigation in ./archive.pages.inc
Theme the archive navigation with years, months and dates by default.

File

./archive.pages.inc, line 374
Pages for the archive module.

Code

function theme_archive_navigation_node_types($variables) {
  $output = "<ul id=\"archive-node_types\">\n";
  $types_count = _archive_node_types($variables['date']);
  $all_count = 0;
  foreach ($types_count as $t) {
    $all_count += $t['count'];
  }
  $output .= '<li' . ($variables['type'] && $variables['type'] != 'all' ? '' : ' class="selected"') . '>' . l(t('All'), _archive_url('all', $variables['date']->year, $variables['date']->month, $variables['date']->day), array(
    'attributes' => array(
      'title' => format_plural($all_count, '1 post', '@count posts'),
    ),
  )) . "</li>\n";
  foreach ($types_count as $ft_key => $ft_value) {
    if (!$ft_value['count']) {
      continue;
    }
    $class = $ft_key == $variables['type'] ? ' class="selected"' : '';
    $name = $ft_value['name'];
    if ($types_count[$ft_key]['count'] > 0) {
      $output .= "<li{$class}>" . l($name, _archive_url($ft_key, $variables['date']->year, $variables['date']->month, $variables['date']->day), array(
        'attributes' => array(
          "title" => format_plural($types_count[$ft_key]['count'], "1 post", "@count posts"),
        ),
      )) . "</li>\n";
    }
    else {
      $output .= "<li{$class}>{$name}</li>\n";
    }
  }
  $output .= "</ul>\n";
  return $output;
}