protected function CalendarPager::getPagerUrl in Calendar 8.2
Same name and namespace in other branches
- 8 src/Plugin/views/pager/CalendarPager.php \Drupal\calendar\Plugin\views\pager\CalendarPager::getPagerUrl()
Get the href value for the pager link.
@TODO fix this
Parameters
string $date_argument: The string used as the contextual filter.
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 An url containing a link.
Throws
\Exception
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 149
Class
- CalendarPager
- The plugin to handle calendar pager.
Namespace
Drupal\calendar\Plugin\views\pagerCode
protected function getPagerUrl($date_argument, $mode, array $input) {
// @TODO add format to $date_argument array?
$format = reset($this->view->argument)
->getArgFormat();
if ($format == 'YW') {
$new = new \DateTime();
$year = (int) substr($date_argument['argument'], 0, 4);
$month = (int) substr($date_argument['argument'], 4, 2);
$new
->setISODate($year, $month);
}
else {
$new = \DateTime::createFromFormat($format, $date_argument['argument']);
}
$new
->modify($mode . '1 ' . $this->styleInfo
->getGranularity());
$value = $new
->format($format);
$current_position = 0;
$arg_vals = [];
/**
* @var \Drupal\views\Plugin\views\argument\ArgumentPluginBase $handler
*/
foreach ($this->view->argument as $name => $argument) {
if (!$argument instanceof Date) {
$arg_vals["arg_{$current_position}"] = $argument
->getValue();
}
else {
$arg_vals["arg_{$current_position}"] = $value;
}
$current_position++;
}
return $this->view
->getUrl($arg_vals, $this->view->current_display);
}