You are here

function theme_archive_navigation_years in Archive 5

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

Theme the list of years for the archive navigation.

Parameters

$type: A string representing the node-type currently being displayed

$date: A date object returned from _archive_date()

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

File

./archive.inc, line 210

Code

function theme_archive_navigation_years($type, $date) {
  $output = "<ul id=\"archive-years\">\n";
  $all_count = 0;
  foreach ($date->years as $year) {
    $all_count += $year;
  }
  $output .= '<li' . ($date->year ? '' : ' class="selected"') . '>' . l(t('All'), _archive_url($type), array(
    'title' => format_plural($all_count, '1 post', '@count posts'),
  )) . "</li>\n";
  foreach ($date->years as $year => $post_count) {
    $class = '';
    if ($year == $date->year) {
      $class = ' class="selected"';
    }
    $output .= '<li' . $class . '>' . l($year, _archive_url($type, $year), array(
      'title' => format_plural($post_count, '1 post', '@count posts'),
    )) . "</li>\n";
  }
  $output .= "</ul>\n";
  return $output;
}