You are here

function theme_archive_navigation_years in Archive 7.2

Same name and namespace in other branches
  1. 5 archive.inc \theme_archive_navigation_years()
  2. 6 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.

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

File

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

Code

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