public function DisplayPluginBase::renderMoreLink in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::renderMoreLink()
Renders the 'more' link.
Overrides DisplayPluginInterface::renderMoreLink
File
- core/
modules/ views/ src/ Plugin/ views/ display/ DisplayPluginBase.php, line 2082 - Contains \Drupal\views\Plugin\views\display\DisplayPluginBase.
Class
- DisplayPluginBase
- Base class for views display plugins.
Namespace
Drupal\views\Plugin\views\displayCode
public function renderMoreLink() {
if ($this
->isMoreEnabled() && ($this
->useMoreAlways() || !empty($this->view->pager) && $this->view->pager
->hasMoreRecords())) {
// If the user has supplied a custom "More" link path, replace any
// argument tokens and use that for the URL.
if ($this
->getOption('link_display') == 'custom_url' && ($override_path = $this
->getOption('link_url'))) {
$tokens = $this
->getArgumentsTokens();
$path = $this
->viewsTokenReplace($override_path, $tokens);
// @todo Views should expect and store a leading /. See:
// https://www.drupal.org/node/2423913
$url = Url::fromUserInput('/' . $path);
}
else {
$url = $this->view
->getUrl(NULL, $this->display['id']);
}
// If a URL is available (either from the display or a custom path),
// render the "More" link.
if ($url) {
$url_options = array();
if (!empty($this->view->exposed_raw_input)) {
$url_options['query'] = $this->view->exposed_raw_input;
}
$url
->setOptions($url_options);
return array(
'#type' => 'more_link',
'#url' => $url,
'#title' => $this
->useMoreText(),
'#view' => $this->view,
);
}
}
}