core/modules/rest/src/Plugin/views/display/RestExport.php | 4 ++-- core/modules/views/src/Plugin/views/display/PathPluginBase.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/modules/rest/src/Plugin/views/display/RestExport.php b/core/modules/rest/src/Plugin/views/display/RestExport.php index 93e286f..f58f159 100644 --- a/core/modules/rest/src/Plugin/views/display/RestExport.php +++ b/core/modules/rest/src/Plugin/views/display/RestExport.php @@ -362,10 +362,10 @@ public function collectRoutes(RouteCollection $collection) { * @return bool TRUE, when the view should override the given route. * TRUE, when the view should override the given route. */ - protected function overrideApplies($view_path, Route $view_route, Route $route) { + protected function _overrideApplies($view_path, Route $view_route, Route $route) { $route_formats = explode('|', $route->getRequirement('_format')); $view_route_formats = explode('|', $view_route->getRequirement('_format')); - return $this->overrideAppliesPathAndMethod($view_path, $view_route, $route) + return $this->_overrideAppliesPathAndMethod($view_path, $view_route, $route) && (!$route->hasRequirement('_format') || array_intersect($route_formats, $view_route_formats) != []); } diff --git a/core/modules/views/src/Plugin/views/display/PathPluginBase.php b/core/modules/views/src/Plugin/views/display/PathPluginBase.php index 3654d63..6a5bbd3 100644 --- a/core/modules/views/src/Plugin/views/display/PathPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/PathPluginBase.php @@ -239,8 +239,8 @@ public function collectRoutes(RouteCollection $collection) { * @return bool * TRUE, when the view should override the given route. */ - protected function overrideApplies($view_path, Route $view_route, Route $route) { - return $this->overrideAppliesPathAndMethod($view_path, $view_route, $route) + protected function _overrideApplies($view_path, Route $view_route, Route $route) { + return $this->_overrideAppliesPathAndMethod($view_path, $view_route, $route) && (!$route->hasRequirement('_format') || $route->getRequirement('_format') === 'html'); } @@ -257,7 +257,7 @@ protected function overrideApplies($view_path, Route $view_route, Route $route) * @return bool * TRUE, when the view should override the given route. */ - protected function overrideAppliesPathAndMethod($view_path, Route $view_route, Route $route) { + protected function _overrideAppliesPathAndMethod($view_path, Route $view_route, Route $route) { // Find all paths which match the path of the current display.. $route_path = RouteCompiler::getPathWithoutDefaults($route); $route_path = RouteCompiler::getPatternOutline($route_path); @@ -281,7 +281,7 @@ public function alterRoutes(RouteCollection $collection) { $view_route = $this->getRoute($view_id, $display_id); foreach ($collection->all() as $name => $route) { - if ($this->overrideApplies($view_path, $view_route, $route)) { + if ($this->_overrideApplies($view_path, $view_route, $route)) { $parameters = $route->compile()->getPathVariables(); // @todo Figure out whether we need to merge some settings (like