function DisplayPluginBase::getMoreUrl
Same name in other branches
- 9 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getMoreUrl()
- 8.9.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getMoreUrl()
- 10 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getMoreUrl()
Get the more URL for this view.
Uses the custom URL if there is one, otherwise the display path.
Return value
\Drupal\Core\Url The more link as Url object.
1 call to DisplayPluginBase::getMoreUrl()
- DisplayPluginBase::renderMoreLink in core/
modules/ views/ src/ Plugin/ views/ display/ DisplayPluginBase.php
File
-
core/
modules/ views/ src/ Plugin/ views/ display/ DisplayPluginBase.php, line 2133
Class
- DisplayPluginBase
- Base class for views display plugins.
Namespace
Drupal\views\Plugin\views\displayCode
protected function getMoreUrl() {
$path = $this->getOption('link_url');
// Return the display URL if there is no custom URL.
if ($this->getOption('link_display') !== 'custom_url' || empty($path)) {
return $this->view
->getUrl(NULL, $this->display['id']);
}
$parts = UrlHelper::parse($path);
$options = $parts;
$tokens = $this->getArgumentsTokens();
// If there are no tokens there is nothing else to do.
if (!empty($tokens)) {
$parts['path'] = $this->viewsTokenReplace($parts['path'], $tokens);
$parts['fragment'] = $this->viewsTokenReplace($parts['fragment'], $tokens);
// Handle query parameters where the key is part of an array.
// For example, f[0] for facets or field_name[id]=id for exposed filters.
$parts['query'] = $this->recursiveReplaceTokens($parts['query'], $tokens);
$options = $parts;
}
$path = $options['path'];
unset($options['path']);
// Create URL.
// @todo Views should expect and store a leading /. See:
// https://www.drupal.org/node/2423913
$url = UrlHelper::isExternal($path) ? Url::fromUri($path, $options) : Url::fromUserInput('/' . ltrim($path, '/'), $options);
// Merge the exposed query parameters.
if (!empty($this->view->exposed_raw_input)) {
$url->mergeOptions([
'query' => $this->view->exposed_raw_input,
]);
}
return $url;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.