function view::get_url

cis7 view.inc view::get_url($args = NULL, $path = NULL)
cle7 view.inc view::get_url($args = NULL, $path = NULL)
elmsmedia7 view.inc view::get_url($args = NULL, $path = NULL)
icor7 view.inc view::get_url($args = NULL, $path = NULL)
meedjum_blog7 view.inc view::get_url($args = NULL, $path = NULL)
mooc7 view.inc view::get_url($args = NULL, $path = NULL)

Get the URL for the current view.

This URL will be adjusted for arguments.

1 call to view::get_url()
view::_build_arguments in sites/all/modules/ulmus/views/includes/view.inc
Build all the arguments.

File

sites/all/modules/ulmus/views/includes/view.inc, line 1581
Provides the view object type and associated methods.

Class

view
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

Code

function get_url($args = NULL, $path = NULL) {
  if (!empty($this->override_url)) {
    return $this->override_url;
  }

  if (!isset($path)) {
    $path = $this->get_path();
  }
  if (!isset($args)) {
    $args = $this->args;

    // Exclude arguments that were computed, not passed on the URL.
    $position = 0;
    if (!empty($this->argument)) {
      foreach ($this->argument as $argument_id => $argument) {
        if (!empty($argument->is_default) && !empty($argument->options['default_argument_skip_url'])) {
          unset($args[$position]);
        }
        $position++;
      }
    }
  }
  // Don't bother working if there's nothing to do:
  if (empty($path) || (empty($args) && strpos($path, '%') === FALSE)) {
    return $path;
  }

  $pieces = array();
  $argument_keys = isset($this->argument) ? array_keys($this->argument) : array();
  $id = current($argument_keys);
  foreach (explode('/', $path) as $piece) {
    if ($piece != '%') {
      $pieces[] = $piece;
    }
    else {
      if (empty($args)) {
        // Try to never put % in a url; use the wildcard instead.
        if ($id && !empty($this->argument[$id]->options['exception']['value'])) {
          $pieces[] = $this->argument[$id]->options['exception']['value'];
        }
        else {
          $pieces[] = '*'; // gotta put something if there just isn't one.
        }

      }
      else {
        $pieces[] = array_shift($args);
      }

      if ($id) {
        $id = next($argument_keys);
      }
    }
  }

  if (!empty($args)) {
    $pieces = array_merge($pieces, $args);
  }
  return implode('/', $pieces);
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.