overrideApplies example

/** * {@inheritdoc} */
  public function alterRoutes(RouteCollection $collection) {
    $view_route_names = [];
    $view_path = $this->getPath();
    $view_id = $this->view->storage->id();
    $display_id = $this->display['id'];
    $view_route = $this->getRoute($view_id$display_id);

    foreach ($collection->all() as $name => $route) {
      if ($this->overrideApplies($view_path$view_route$route)) {
        $parameters = $route->compile()->getPathVariables();

        // @todo Figure out whether we need to merge some settings (like         // requirements).
        // Replace the existing route with a new one based on views.         $original_route = $collection->get($name);
        $collection->remove($name);

        $path = $view_route->getPath();
        // Replace the path with the original parameter names and add a mapping.
Home | Imprint | This part of the site doesn't use cookies.