function PathPluginBase::overrideAppliesPathAndMethod

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/display/PathPluginBase.php \Drupal\views\Plugin\views\display\PathPluginBase::overrideAppliesPathAndMethod()
  2. 8.9.x core/modules/views/src/Plugin/views/display/PathPluginBase.php \Drupal\views\Plugin\views\display\PathPluginBase::overrideAppliesPathAndMethod()
  3. 10 core/modules/views/src/Plugin/views/display/PathPluginBase.php \Drupal\views\Plugin\views\display\PathPluginBase::overrideAppliesPathAndMethod()

Determines whether an override for the path and method should happen.

Parameters

string $view_path: The path of the view.

\Symfony\Component\Routing\Route $view_route: The route of the view.

\Symfony\Component\Routing\Route $route: The route itself.

Return value

bool TRUE, when the view should override the given route.

2 calls to PathPluginBase::overrideAppliesPathAndMethod()
PathPluginBase::overrideApplies in core/modules/views/src/Plugin/views/display/PathPluginBase.php
Determines whether the view overrides the given route.
RestExport::overrideApplies in core/modules/rest/src/Plugin/views/display/RestExport.php
Determines whether the view overrides the given route.

File

core/modules/views/src/Plugin/views/display/PathPluginBase.php, line 266

Class

PathPluginBase
The base display plugin for path/callbacks. This is used for pages and feeds.

Namespace

Drupal\views\Plugin\views\display

Code

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);
    // Ensure that we don't override a route which is already controlled by
    // views.
    return !$route->hasDefault('view_id') && '/' . $view_path == $route_path && (!$route->getMethods() || in_array('GET', $route->getMethods()));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.