diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 94e9200..fd98caf 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -2088,12 +2088,26 @@ public function renderMoreLink() { } $url->setOptions($url_options); - return array( - '#type' => 'more_link', - '#url' => $url, - '#title' => $this->useMoreText(), - '#view' => $this->view, - ); + if ($url->access()) { + $more_link = [ + '#type' => 'more_link', + '#url' => $url, + '#title' => $this->useMoreText(), + '#view' => $this->view, + ]; + } + else { + $more_link = []; + } + + // Add cache metadata with the link target page. + if ($url->isRouted()) { + $more_link['#cache']['tags'][] = 'route_match'; + $more_link['#cache']['contexts'][] = $url->toUriString(); + $this->applyDisplayCachablityMetadata($more_link); + } + + return $more_link; } } }