From 485cf207771a134ead8a241dd1c283b383eccac3 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 9 Apr 2024 15:27:49 +0100
Subject: [PATCH] Issue #3436814 by fromme, smustgrave: Use provider in
 ViewExecutable::hasUrl() instead of \Drupal::service()

(cherry picked from commit c9879d2d551e84cb7dc848497dd2acc3b00f4820)
---
 core/modules/views/src/ViewExecutable.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php
index 7d73d7f21264..21602d627348 100644
--- a/core/modules/views/src/ViewExecutable.php
+++ b/core/modules/views/src/ViewExecutable.php
@@ -1921,12 +1921,11 @@ public function hasUrl($args = NULL, $display_id = NULL) {
       return FALSE;
     }
 
-    // Look up the route name to make sure it exists.  The name may exist, but
+    // Look up the route name to make sure it exists. The name may exist, but
     // not be available yet in some instances when editing a view and doing
     // a live preview.
-    $provider = \Drupal::service('router.route_provider');
     try {
-      $provider->getRouteByName($display_handler->getRouteName());
+      $this->routeProvider->getRouteByName($display_handler->getRouteName());
     }
     catch (RouteNotFoundException $e) {
       return FALSE;
-- 
GitLab