From b819d5cbec0716cfe8675f0f17a25a6517dc988d Mon Sep 17 00:00:00 2001
From: Mac_Weber <Mac_Weber@789986.no-reply.drupal.org>
Date: Tue, 14 Jun 2016 14:45:12 -0300
Subject: [PATCH] Issue #2699545 by Swetha Yarla, Mac_Weber, N.kishorekumar,
 heykarthikwithu, vg3095: Replace \Drupal::l with Link::fromTextAndUrl in Link
 module

---
 core/modules/link/link.module                                      | 3 ++-
 core/modules/link/src/Tests/LinkFieldTest.php                      | 5 +++--
 core/modules/link/templates/link-formatter-link-separate.html.twig | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/core/modules/link/link.module b/core/modules/link/link.module
index 46aeeba..caf8a79 100644
--- a/core/modules/link/link.module
+++ b/core/modules/link/link.module
@@ -5,6 +5,7 @@
  * Defines simple link field types.
  */
 
+use Drupal\Core\Link;
 use Drupal\Core\Routing\RouteMatchInterface;
 
 /**
@@ -61,5 +62,5 @@ function link_theme() {
  *   - url: A \Drupal\Core\Url object.
  */
 function template_preprocess_link_formatter_link_separate(&$variables) {
-  $variables['link'] = \Drupal::l($variables['url_title'], $variables['url']);
+  $variables['link'] = Link::fromTextAndUrl($variables['url_title'], $variables['url'])->toString();
 }
diff --git a/core/modules/link/src/Tests/LinkFieldTest.php b/core/modules/link/src/Tests/LinkFieldTest.php
index e85ad53..84e90f5 100644
--- a/core/modules/link/src/Tests/LinkFieldTest.php
+++ b/core/modules/link/src/Tests/LinkFieldTest.php
@@ -4,6 +4,7 @@
 
 use Drupal\Component\Utility\Html;
 use Drupal\Component\Utility\Unicode;
+use Drupal\Core\Link;
 use Drupal\Core\Url;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\field\Entity\FieldConfig;
@@ -318,7 +319,7 @@ function testLinkTitle() {
     $this->assertText(t('entity_test @id has been created.', array('@id' => $id)));
 
     $this->renderTestEntity($id);
-    $expected_link = \Drupal::l($value, Url::fromUri($value));
+    $expected_link = Link::fromTextAndUrl($value, Url::fromUri($value))->toString();
     $this->assertRaw($expected_link);
 
     // Verify that a link with text is rendered using the link text.
@@ -330,7 +331,7 @@ function testLinkTitle() {
     $this->assertText(t('entity_test @id has been updated.', array('@id' => $id)));
 
     $this->renderTestEntity($id);
-    $expected_link = \Drupal::l($title, Url::fromUri($value));
+    $expected_link = Link::fromTextAndUrl($title, Url::fromUri($value))->toString();
     $this->assertRaw($expected_link);
   }
 
diff --git a/core/modules/link/templates/link-formatter-link-separate.html.twig b/core/modules/link/templates/link-formatter-link-separate.html.twig
index 469cd9a..b238b4e 100644
--- a/core/modules/link/templates/link-formatter-link-separate.html.twig
+++ b/core/modules/link/templates/link-formatter-link-separate.html.twig
@@ -4,7 +4,8 @@
  * Default theme implementation of a link with separate title and URL elements.
  *
  * Available variables:
- * - link: The link that has already been formatted by l().
+ * - link: The link that has already been formatted by
+ *   \Drupal\Core\Link::fromTextAndUrl()->toString().
  * - title: (optional) A descriptive or alternate title for the link, which may
  *   be different than the actual link text.
  *
-- 
2.8.1

