You are here

function _archive_url in Archive 5

Same name and namespace in other branches
  1. 6 archive.module \_archive_url()
  2. 7.2 archive.module \_archive_url()
  3. 7 archive.module \_archive_url()

Generate an archive URL based on the $y, $m and $d provided, falling back on the $date properties if an invalid date is specified.

Validation checking included for $date properties, because those could be zero, if not defined from the URL.

Parameters

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

$y: The year to use if valid

$m: The month to use if valid

$d: The day to use if valid

Return value

A string with the generated archive URL

6 calls to _archive_url()
theme_archive_block_calendar in ./archive.module
Returns a single month as a calendar grid TODO: take the archive logic out to allow better theme-overloading of this Pass days with post numbers to this function and have this function only create the calendar
theme_archive_navigation_days in ./archive.inc
Theme the list of days for the archive navigation.
theme_archive_navigation_months in ./archive.inc
Theme the list of months for the archive navigation.
theme_archive_navigation_node_types in ./archive.inc
Theme the list of node types for the archives
theme_archive_navigation_years in ./archive.inc
Theme the list of years for the archive navigation.

... See full list

File

./archive.module, line 159

Code

function _archive_url($type, $y = 0, $m = 0, $d = 0) {
  $url = 'archive';
  if (_archive_validate_type($type)) {
    $url .= '/' . $type;
  }
  else {
    $url .= '/all';
  }
  if (_archive_validate_year($y)) {
    $url .= '/' . $y;
    if (_archive_validate_month($m)) {
      $url .= '/' . $m;
      if (_archive_validate_day($y, $m, $d)) {
        $url .= '/' . $d;
      }
    }
  }
  return $url;
}