You are here

protected function RestExport::overrideApplies in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/rest/src/Plugin/views/display/RestExport.php \Drupal\rest\Plugin\views\display\RestExport::overrideApplies()
  2. 10 core/modules/rest/src/Plugin/views/display/RestExport.php \Drupal\rest\Plugin\views\display\RestExport::overrideApplies()

Determines whether the view overrides the given route.

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.

Overrides PathPluginBase::overrideApplies

File

core/modules/rest/src/Plugin/views/display/RestExport.php, line 385

Class

RestExport
The plugin that handles Data response callbacks for REST resources.

Namespace

Drupal\rest\Plugin\views\display

Code

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) && (!$route
    ->hasRequirement('_format') || array_intersect($route_formats, $view_route_formats) != []);
}