You are here

protected function CalendarPager::getPagerUrl in Calendar 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/pager/CalendarPager.php \Drupal\calendar\Plugin\views\pager\CalendarPager::getPagerUrl()

Get the href value for the pager link.

Parameters

string $mode: Either '-' or '+' to determine which direction.

array $input: Any extra GET parameters that should be retained, such as exposed input.

Return value

string Url.

1 call to CalendarPager::getPagerUrl()
CalendarPager::render in src/Plugin/views/pager/CalendarPager.php
Return the renderable array of the pager.

File

src/Plugin/views/pager/CalendarPager.php, line 94

Class

CalendarPager
The plugin to handle calendar pager.

Namespace

Drupal\calendar\Plugin\views\pager

Code

protected function getPagerUrl($mode, array $input) {
  $value = $this
    ->getPagerArgValue($mode);
  $current_position = 0;
  $arg_vals = [];

  /**
   * @var \Drupal\views\Plugin\views\argument\ArgumentPluginBase $handler
   */
  foreach ($this->view->argument as $name => $handler) {
    if ($current_position != $this->argument
      ->getPosition()) {
      $arg_vals["arg_{$current_position}"] = $handler
        ->getValue();
    }
    else {
      $arg_vals["arg_{$current_position}"] = $value;
    }
    $current_position++;
  }
  $display_handler = $this->view->displayHandlers
    ->get($this->view->current_display)
    ->getRoutedDisplay();
  if ($display_handler) {
    $url = $this->view
      ->getUrl($arg_vals, $this->view->current_display);
  }
  else {
    $url = Url::fromRoute('<current>', [], [])
      ->toString();
  }
  if (!empty($input)) {
    $url
      ->setOption('query', $input);
  }
  return $url;
}