You are here

function date_views_real_url in Date 6.2

Same name and namespace in other branches
  1. 7 date_views/includes/date_views.views.inc \date_views_real_url()

Figure out what the URL of the calendar view we're currently looking at is.

1 call to date_views_real_url()
date_views_page_url in includes/date_api.views.inc
Identify the base url of the page, needed when the calendar is embedded so we don't set the url to the calendar url.

File

includes/date_api.views.inc, line 245
Defines date-related Views data and plugins:

Code

function date_views_real_url($view, $args) {
  if (empty($args)) {
    return $view->date_info->url;
  }

  // Add non-calendar arguments to the base url.
  $parts = explode('/', $view->date_info->url);
  $bump = 0;
  foreach ($parts as $delta => $part) {

    // If one of the args is buried in the url, add it here and adjust
    // the delta values we'll compare the calendar arg positions to.
    if (drupal_substr($part, 0, 1) == '$') {
      $parts[$delta] = array_shift($args);
      $bump++;
    }
  }
  foreach ($args as $delta => $arg) {
    if (!in_array($delta + $bump, calendar_arg_positions($view)) && !empty($arg)) {
      array_push($parts, $arg);
    }
  }
  return implode('/', $parts);
}