diff --git a/payment/uc_2checkout/src/Controller/CheckoutController.php b/payment/uc_2checkout/src/Controller/CheckoutController.php
index c6e4b90..08258e0 100644
--- a/payment/uc_2checkout/src/Controller/CheckoutController.php
+++ b/payment/uc_2checkout/src/Controller/CheckoutController.php
@@ -10,6 +10,7 @@ namespace Drupal\uc_2checkout\Controller;
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\Url;
 use Drupal\uc_order\Entity\Order;
 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
 
@@ -41,8 +42,8 @@ class CheckoutController extends ControllerBase {
     }
 
     if ($_REQUEST['demo'] == 'Y' xor $module_config->get('demo')) {
-      $this->logger('uc_2checkout')->error('The 2checkout payment for order <a href="@order_url">@order_id</a> demo flag was set to %flag, but the module is set to %mode mode.', array(
-        '@order_url' => url('admin/store/orders/' . $order->id()),
+      $this->logger('uc_2checkout')->error('The 2checkout payment for order <a href=":order_url">@order_id</a> demo flag was set to %flag, but the module is set to %mode mode.', array(
+        ':order_url' => Url::fromRoute('entity.uc_order.canonical', ['uc_order' => $order->id()])->toString(),
         '@order_id' => $order->id(),
         '%flag' => $_REQUEST['demo'] == 'Y' ? 'Y' : 'N',
         '%mode' => $module_config->get('demo') ? 'Y' : 'N',
@@ -72,7 +73,7 @@ class CheckoutController extends ControllerBase {
     }
     else {
       drupal_set_message(t('Your order will be processed as soon as your payment clears at 2Checkout.com.'));
-      uc_order_comment_save($order->id(), 0, t('@type payment is pending approval at 2Checkout.com.', ['@type' => $_REQUEST['pay_method'] == 'CC' ? t('Credit card') : t('eCheck'))], 'admin');
+      uc_order_comment_save($order->id(), 0, t('@type payment is pending approval at 2Checkout.com.', ['@type' => $_REQUEST['pay_method'] == 'CC' ? t('Credit card') : t('eCheck')]), 'admin');
     }
 
     // Empty that cart...
diff --git a/payment/uc_2checkout/uc_2checkout.module b/payment/uc_2checkout/uc_2checkout.module
index b5ed8ac..8736ce3 100644
--- a/payment/uc_2checkout/uc_2checkout.module
+++ b/payment/uc_2checkout/uc_2checkout.module
@@ -7,6 +7,7 @@
 
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Url;
 
 /**
  * Implements hook_help().
@@ -171,7 +172,7 @@ function uc_2checkout_form($form, &$form_state, $order) {
     'demo' => $module_config->get('demo') ? 'Y' : 'N',
     'fixed' => 'Y',
     'lang' => $module_config->get('language'),
-    'x_receipt_link_url' => url('cart/2checkout/complete/' . uc_cart_get_id(), array('absolute' => TRUE)),
+    'x_receipt_link_url' => Url::fromRoute('uc_2checkout.complete', ['cart_id' => uc_cart_get_id()], ['absolute' => TRUE])->toString(),
     'merchant_order_id' => $order->id(),
     'pay_method' => isset($_SESSION['pay_method']) ? $_SESSION['pay_method'] : 'CC',
     'card_holder_name' => Unicode::substr($order->billing_first_name . ' ' . $order->billing_last_name, 0, 128),
diff --git a/payment/uc_payment/src/Form/OrderPaymentsForm.php b/payment/uc_payment/src/Form/OrderPaymentsForm.php
index fac9577..129f722 100644
--- a/payment/uc_payment/src/Form/OrderPaymentsForm.php
+++ b/payment/uc_payment/src/Form/OrderPaymentsForm.php
@@ -10,7 +10,7 @@ namespace Drupal\uc_payment\Form;
 use Drupal\Component\Utility\Xss;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Url;
+use Drupal\Core\Link;
 use Drupal\uc_order\OrderInterface;
 use Drupal\uc_payment\Plugin\PaymentMethodManager;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -108,7 +108,7 @@ class OrderPaymentsForm extends FormBase {
           '#markup' => ($payment->comment == '') ? '-' : Xss::filterAdmin($payment->comment),
         );
         if ($account->hasPermission('delete payments')) {
-          $action_value = $this->l($this->t('Delete'), Url::fromRoute('uc_payments.delete', ['uc_order' => $this->order->id(), 'payment' => $payment->receipt_id]));
+          $action_value = Link::createFromRoute($this->t('Delete'), 'uc_payments.delete', ['uc_order' => $this->order->id(), 'payment' => $payment->receipt_id])->toString();
         }
         else {
           $action_value = '-';
diff --git a/payment/uc_paypal/uc_paypal.pages.inc b/payment/uc_paypal/uc_paypal.pages.inc
index 1ddd1e1..fbc9f31 100644
--- a/payment/uc_paypal/uc_paypal.pages.inc
+++ b/payment/uc_paypal/uc_paypal.pages.inc
@@ -8,6 +8,7 @@
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Link;
 use Drupal\uc_order\Entity\Order;
 
 /**
@@ -35,12 +36,12 @@ function uc_paypal_ipn() {
     $order_id = intval($_POST['invoice']);
   }
 
-  \Drupal::logger('uc_paypal')->notice('Receiving IPN at URL for order @order_id. <pre>@debug</pre>', array('@order_id' => $order_id, '@debug' => variable_get('uc_paypal_wps_debug_ipn', FALSE) ? print_r($_POST, TRUE) : ''));
+  \Drupal::logger('uc_paypal')->notice('Receiving IPN at URL for order @order_id. <pre>@debug</pre>', ['@order_id' => $order_id, '@debug' => variable_get('uc_paypal_wps_debug_ipn', FALSE) ? print_r($_POST, TRUE) : '']);
 
   $order = Order::load($order_id);
 
   if ($order == FALSE) {
-    \Drupal::logger('uc_paypal')->error('IPN attempted for non-existent order @order_id.', array('@order_id' => $order_id));
+    \Drupal::logger('uc_paypal')->error('IPN attempted for non-existent order @order_id.', ['@order_id' => $order_id]);
     return;
   }
 
@@ -84,14 +85,14 @@ function uc_paypal_ipn() {
     ->send();
 
   if ($response->isError()) {
-    \Drupal::logger('uc_paypal')->error('IPN failed with HTTP error @error, code @code.', array('@error' => $response->getReasonPhrase(), '@code' => $response->getStatusCode()));
+    \Drupal::logger('uc_paypal')->error('IPN failed with HTTP error @error, code @code.', ['@error' => $response->getReasonPhrase(), '@code' => $response->getStatusCode()]);
     return;
   }
 
   if (strcmp($response->getBody(TRUE), 'VERIFIED') == 0) {
     \Drupal::logger('uc_paypal')->notice('IPN transaction verified.');
 
-    $duplicate = (bool) db_query_range('SELECT 1 FROM {uc_payment_paypal_ipn} WHERE txn_id = :id AND status <> :status', 0, 1, array(':id' => $txn_id, ':status' => 'Pending'))->fetchField();
+    $duplicate = (bool) db_query_range('SELECT 1 FROM {uc_payment_paypal_ipn} WHERE txn_id = :id AND status <> :status', 0, 1, [':id' => $txn_id, ':status' => 'Pending'])->fetchField();
     if ($duplicate) {
       if ($order->getPaymentMethodId() != 'credit') {
         \Drupal::logger('uc_paypal')->notice('IPN transaction ID has been processed before.');
@@ -114,17 +115,17 @@ function uc_paypal_ipn() {
 
     switch ($payment_status) {
       case 'Canceled_Reversal':
-        uc_order_comment_save($order_id, 0, t('PayPal has canceled the reversal and returned !amount !currency to your account.', array('!amount' => uc_currency_format($payment_amount, FALSE), '!currency' => $payment_currency)), 'admin');
+        uc_order_comment_save($order_id, 0, t('PayPal has canceled the reversal and returned @amount @currency to your account.', ['@amount' => uc_currency_format($payment_amount, FALSE), '@currency' => $payment_currency]), 'admin');
         break;
 
       case 'Completed':
         if (abs($payment_amount - $order->getTotal()) > 0.01) {
-          \Drupal::logger('uc_paypal')->warning('Payment @txn_id for order @order_id did not equal the order total.', array('@txn_id' => $txn_id, '@order_id' => $order->id(), 'link' => l(t('view'), 'admin/store/orders/' . $order->id())));
+          \Drupal::logger('uc_paypal')->warning('Payment @txn_id for order @order_id did not equal the order total.', ['@txn_id' => $txn_id, '@order_id' => $order->id(), 'link' => Link::createFromRoute(t('view'), 'entity.uc_order.canonical', ['uc_order' => $order->id()])->toString()]);
         }
-        $comment = t('PayPal transaction ID: @txn_id', array('@txn_id' => $txn_id));
+        $comment = t('PayPal transaction ID: @txn_id', ['@txn_id' => $txn_id]);
         uc_payment_enter($order_id, 'paypal_wps', $payment_amount, $order->getOwnerId(), NULL, $comment);
         uc_cart_complete_sale($order);
-        uc_order_comment_save($order_id, 0, t('PayPal IPN reported a payment of @amount @currency.', array('@amount' => uc_currency_format($payment_amount, FALSE), '@currency' => $payment_currency)));
+        uc_order_comment_save($order_id, 0, t('PayPal IPN reported a payment of @amount @currency.', ['@amount' => uc_currency_format($payment_amount, FALSE), '@currency' => $payment_currency]));
         break;
 
       case 'Denied':
@@ -141,18 +142,18 @@ function uc_paypal_ipn() {
 
       case 'Pending':
         $order->setStatusId('paypal_pending')->save();
-        uc_order_comment_save($order_id, 0, t('Payment is pending at PayPal: @reason', array('@reason' => _uc_paypal_pending_message(SafeMarkup::checkPlain($_POST['pending_reason'])))), 'admin');
+        uc_order_comment_save($order_id, 0, t('Payment is pending at PayPal: @reason', ['@reason' => _uc_paypal_pending_message(SafeMarkup::checkPlain($_POST['pending_reason']))]), 'admin');
         break;
 
       // You, the merchant, refunded the payment.
       case 'Refunded':
-        $comment = t('PayPal transaction ID: @txn_id', array('@txn_id' => $txn_id));
+        $comment = t('PayPal transaction ID: @txn_id', ['@txn_id' => $txn_id]);
         uc_payment_enter($order_id, 'paypal_wps', $payment_amount, $order->getOwnerId(), NULL, $comment);
         break;
 
       case 'Reversed':
         \Drupal::logger('uc_paypal')->error('PayPal has reversed a payment!');
-        uc_order_comment_save($order_id, 0, t('Payment has been reversed by PayPal: @reason', array('@reason' => _uc_paypal_reversal_message(SafeMarkup::checkPlain($_POST['reason_code'])))), 'admin');
+        uc_order_comment_save($order_id, 0, t('Payment has been reversed by PayPal: @reason', ['@reason' => _uc_paypal_reversal_message(SafeMarkup::checkPlain($_POST['reason_code']))]), 'admin');
         break;
 
       case 'Processed':
@@ -334,7 +335,7 @@ function uc_paypal_ec_review_form_submit($form, FormStateInterface $form_state)
     $quote_option = $form_state->getValue(['quotes', 'quote_option']);
     $order->quote['rate'] = $form_state->getValue(['quotes', $quote_option, 'rate']);
 
-    $result = db_query("SELECT line_item_id FROM {uc_order_line_items} WHERE order_id = :id AND type = :type", array(':id' => $order->id(), ':type' => 'shipping'));
+    $result = db_query("SELECT line_item_id FROM {uc_order_line_items} WHERE order_id = :id AND type = :type", [':id' => $order->id(), ':type' => 'shipping']);
     if ($lid = $result->fetchField()) {
       uc_order_update_line_item($lid, $label, $order->quote['rate']);
     }
diff --git a/shipping/uc_shipping/uc_shipping.module b/shipping/uc_shipping/uc_shipping.module
index 18c8122..7c79bbe 100644
--- a/shipping/uc_shipping/uc_shipping.module
+++ b/shipping/uc_shipping/uc_shipping.module
@@ -13,6 +13,7 @@ use Drupal\Component\Utility\Xss;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Render\BubbleableMetadata;
 use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Link;
 use Drupal\Core\Url;
 use Drupal\uc_order\Entity\Order;
 use Drupal\uc_order\OrderInterface;
@@ -259,7 +260,7 @@ function template_preprocess_uc_packing_slip(&$variables) {
   $variables['store_phone'] = $tokens['phone'];
 
   $order = $variables['order'];
-  $variables['order_link'] = l($order->id(), url('user/' . $order->getOwnerId() . '/orders/' . $order->id(), array('absolute' => TRUE)));
+  $variables['order_link'] = Link::createFromRoute($order->id(), 'uc_order.user_view', ['user' => $order->getOwnerId(), 'uc_order' => $order->id()], ['absolute' => TRUE])->toString();
   $variables['order_email'] = $order->getEmail();
   $variables['billing_address'] = $order->getAddress('billing');
   $variables['billing_phone'] = $order->getAddress('billing')->phone;
@@ -373,7 +374,7 @@ function uc_shipping_package_view($package) {
 
   if ($shipment && isset($package->label_image) &&
       file_exists($package->label_image->uri)) {
-    $rows[] = array(t('Label:'), l(t('Click to view.'), 'admin/store/orders/' . $package->order_id . '/shipments/labels/' . $shipment->shipping_method . '/' . $package->label_image->uri));
+    $rows[] = array(t('Label:'), Link::fromTextAndUrl(t('Click to view.'), Url::fromUri('admin/store/orders/' . $package->order_id . '/shipments/labels/' . $shipment->shipping_method . '/' . $package->label_image->uri))->toString());
   }
   else {
     $rows[] = array(t('Label:'), t('n/a'));
diff --git a/uc_attribute/src/Form/AttributeFormBase.php b/uc_attribute/src/Form/AttributeFormBase.php
index ed05286..043af81 100644
--- a/uc_attribute/src/Form/AttributeFormBase.php
+++ b/uc_attribute/src/Form/AttributeFormBase.php
@@ -9,7 +9,7 @@ namespace Drupal\uc_attribute\Form;
 
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Url;
+use Drupal\Core\Link;
 
 /**
  * Defines the attribute add/edit edit form.
@@ -72,7 +72,7 @@ abstract class AttributeFormBase extends FormBase {
     $form['actions']['submit'] = array(
       '#type' => 'submit',
       '#value' => $this->t('Submit'),
-      '#suffix' => $this->l($this->t('Cancel'), Url::fromRoute('uc_attribute.overview')),
+      '#suffix' => Link::createFromRoute($this->t('Cancel'), 'uc_attribute.overview')->toString(),
     );
 
     return $form;
diff --git a/uc_attribute/src/Form/OptionFormBase.php b/uc_attribute/src/Form/OptionFormBase.php
index cfcf070..6f5d9d0 100644
--- a/uc_attribute/src/Form/OptionFormBase.php
+++ b/uc_attribute/src/Form/OptionFormBase.php
@@ -9,7 +9,7 @@ namespace Drupal\uc_attribute\Form;
 
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Url;
+use Drupal\Core\Link;
 
 /**
  * Defines the attribute option add/edit edit form.
@@ -76,7 +76,7 @@ abstract class OptionFormBase extends FormBase {
     $form['actions']['submit'] = array(
       '#type' => 'submit',
       '#value' => $this->t('Submit'),
-      '#suffix' => $this->l($this->t('Cancel'), Url::fromRoute('uc_attribute.options', ['aid' => $aid])),
+      '#suffix' => Link::createFromRoute($this->t('Cancel'), 'uc_attribute.options', ['aid' => $aid])->toString(),
       '#weight' => 10,
     );
 
diff --git a/uc_cart/src/Controller/CheckoutController.php b/uc_cart/src/Controller/CheckoutController.php
index df79407..b84e645 100644
--- a/uc_cart/src/Controller/CheckoutController.php
+++ b/uc_cart/src/Controller/CheckoutController.php
@@ -9,6 +9,7 @@ namespace Drupal\uc_cart\Controller;
 
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
+use Drupal\Core\Url;
 use Drupal\uc_cart\CartInterface;
 use Drupal\uc_cart\CartManagerInterface;
 use Drupal\uc_cart\Plugin\CheckoutPaneManager;
@@ -72,7 +73,7 @@ class CheckoutController extends ControllerBase implements ContainerInjectionInt
     if ($this->currentUser()->isAnonymous() && !$cart_config->get('checkout_anonymous')) {
       drupal_set_message($this->t('You must login before you can proceed to checkout.'));
       if ($this->config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) {
-        drupal_set_message($this->t('If you do not have an account yet, you should <a href=":url">register now</a>.', [':url' => $this->url('user.register', [], ['query' => drupal_get_destination()])]));
+        drupal_set_message($this->t('If you do not have an account yet, you should <a href=":url">register now</a>.', [':url' => Url::fromRoute('user.register', [], ['query' => drupal_get_destination()])->toString()]));
       }
       return $this->redirect('user.page', [], ['query' => drupal_get_destination()]);
     }
@@ -156,7 +157,7 @@ class CheckoutController extends ControllerBase implements ContainerInjectionInt
 
     $min = $cart_config->get('minimum_subtotal');
     if ($min > 0 && $order->getSubtotal() < $min) {
-      drupal_set_message($this->t('The minimum order subtotal for checkout is @min.', array('@min' => uc_currency_format($min))), 'error');
+      drupal_set_message($this->t('The minimum order subtotal for checkout is @min.', ['@min' => uc_currency_format($min)]), 'error');
       return $this->redirect('uc_cart.cart');
     }
 
diff --git a/uc_cart/src/Form/CartSettingsForm.php b/uc_cart/src/Form/CartSettingsForm.php
index 8be732d..306e819 100644
--- a/uc_cart/src/Form/CartSettingsForm.php
+++ b/uc_cart/src/Form/CartSettingsForm.php
@@ -9,6 +9,7 @@ namespace Drupal\uc_cart\Form;
 
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
 
 /**
  * Configure general shopping cart settings for this site.
@@ -63,7 +64,7 @@ class CartSettingsForm extends ConfigFormBase {
       '#description' => t('Enter the page to redirect to when a customer adds an item to their cart, or &lt;none&gt; for no redirect.'),
       '#default_value' => $cart_config->get('add_item_redirect'),
       '#size' => 32,
-      '#field_prefix' => $this->url('<front>', [], ['absolute' => TRUE]),
+      '#field_prefix' => Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString(),
     );
 
     $form['general']['uc_cart_empty_button'] = array(
@@ -161,7 +162,7 @@ class CartSettingsForm extends ConfigFormBase {
       '#title' => t('Default <em>continue shopping</em> destination'),
       '#default_value' => $cart_config->get('continue_shopping_url'),
       '#size' => 32,
-      '#field_prefix' => $this->url('<front>', [], ['absolute' => TRUE]),
+      '#field_prefix' => Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString(),
     );
 
     $form['breadcrumb'] = array(
@@ -181,7 +182,7 @@ class CartSettingsForm extends ConfigFormBase {
       '#title' => t('Cart page breadcrumb destination'),
       '#default_value' => $cart_config->get('breadcrumb_url'),
       '#size' => 32,
-      '#field_prefix' => $this->url('<front>', [], ['absolute' => TRUE]),
+      '#field_prefix' => Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString(),
     );
 
     return parent::buildForm($form, $form_state);
diff --git a/uc_cart/uc_cart.api.php b/uc_cart/uc_cart.api.php
index f6680cd..86975fd 100644
--- a/uc_cart/uc_cart.api.php
+++ b/uc_cart/uc_cart.api.php
@@ -125,7 +125,7 @@ function hook_uc_cart_display($item) {
   $element['remove'] = array('#type' => 'checkbox');
 
   $element['title'] = array(
-    '#markup' => $node->access('view') ? l($item->title, 'node/' . $item->nid) : $item->title,
+    '#markup' => $node->access('view') ? \Drupal\Core\Link::createFromRoute($item->title, 'entity.node.canonical', ['node' => $item->nid])->toString() : $item->title,
   );
 
 
@@ -197,7 +197,7 @@ function hook_uc_cart_item_delete($entity) {
 function hook_uc_checkout_complete($order, $account) {
   // Get previous records of customer purchases.
   $nids = array();
-  $result = db_query("SELECT uid, nid, qty FROM {uc_customer_purchases} WHERE uid = :uid", array(':uid' => $account->id()));
+  $result = db_query("SELECT uid, nid, qty FROM {uc_customer_purchases} WHERE uid = :uid", [':uid' => $account->id()]);
   foreach ($result as $record) {
     $nids[$record->nid] = $record->qty;
   }
diff --git a/uc_cart_links/src/Form/CartLinksSettingsForm.php b/uc_cart_links/src/Form/CartLinksSettingsForm.php
index 99908a5..f3eda31 100644
--- a/uc_cart_links/src/Form/CartLinksSettingsForm.php
+++ b/uc_cart_links/src/Form/CartLinksSettingsForm.php
@@ -9,6 +9,7 @@ namespace Drupal\uc_cart_links\Form;
 
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
 
 /**
  * Configure general shopping cart settings for this site.
@@ -70,7 +71,7 @@ class CartLinksSettingsForm extends ConfigFormBase {
       '#description' => $this->t('Enter the URL to redirect to when an invalid cart link is used.'),
       '#default_value' => $cart_links_config->get('invalid_page'),
       '#size' => 32,
-      '#field_prefix' => $this->url('<front>', [], ['absolute' => TRUE]),
+      '#field_prefix' => Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString(),
     );
 
     return parent::buildForm($form, $form_state);
diff --git a/uc_catalog/src/Controller/CatalogAdminController.php b/uc_catalog/src/Controller/CatalogAdminController.php
index 16f9047..ebb7259 100644
--- a/uc_catalog/src/Controller/CatalogAdminController.php
+++ b/uc_catalog/src/Controller/CatalogAdminController.php
@@ -8,7 +8,7 @@
 namespace Drupal\uc_catalog\Controller;
 
 use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Url;
+use Drupal\Core\Link;
 use Drupal\field\Entity\FieldStorageConfig;
 
 /**
@@ -53,7 +53,7 @@ class CatalogAdminController extends ControllerBase {
 
       $rows = array();
       while ($node = $result->fetchObject()) {
-        $rows[] = $this->l($node->title, Url::fromRoute('entity.node.edit_form', ['node' => $node->nid], ['query' => ['destination' => 'admin/store/products/orphans']]));
+        $rows[] = Link::createFromRoute($node->title, 'entity.node.edit_form', ['node' => $node->nid], ['query' => ['destination' => 'admin/store/products/orphans']])->toString();
       }
 
       if (count($rows) > 0) {
diff --git a/uc_catalog/src/Form/CatalogSettingsForm.php b/uc_catalog/src/Form/CatalogSettingsForm.php
index 38cb0b0..332251b 100644
--- a/uc_catalog/src/Form/CatalogSettingsForm.php
+++ b/uc_catalog/src/Form/CatalogSettingsForm.php
@@ -9,6 +9,7 @@ namespace Drupal\uc_catalog\Form;
 
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
 use Drupal\taxonomy\Entity\Vocabulary;
 use Drupal\views\Views;
 
@@ -60,7 +61,7 @@ class CatalogSettingsForm extends ConfigFormBase {
       $catalog = Vocabulary::load($vid);
 
       $form['catalog_vid'] = array(
-        '#markup' => '<p>' . $this->t('The taxonomy vocabulary <a href=":edit-url">%name</a> is set as the product catalog.', array(':edit-url' => $this->url('entity.taxonomy_vocabulary.edit_form', ['taxonomy_vocabulary' => $catalog->id()]), '%name' => $catalog->label())) . '</p>',
+        '#markup' => '<p>' . $this->t('The taxonomy vocabulary <a href=":edit-url">%name</a> is set as the product catalog.', [':edit-url' => Url::fromRoute('entity.taxonomy_vocabulary.edit_form', ['taxonomy_vocabulary' => $catalog->id()])->toString(), '%name' => $catalog->label()]) . '</p>',
       );
     }
 
diff --git a/uc_file/src/Form/ShowForm.php b/uc_file/src/Form/ShowForm.php
index 0767421..fd49f45 100644
--- a/uc_file/src/Form/ShowForm.php
+++ b/uc_file/src/Form/ShowForm.php
@@ -9,6 +9,7 @@ namespace Drupal\uc_file\Form;
 
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Link;
 use Drupal\Core\Url;
 use Drupal\Component\Utility\SafeMarkup;
 
@@ -71,7 +72,7 @@ class ShowForm extends FormBase {
           'data' => SafeMarkup::checkPlain($file->filename),
           'class' => is_dir(uc_file_qualify_file($file->filename)) ? array('uc-file-directory-view') : array(),
         ),
-        'title' => $this->l($file->title, Url::fromRoute('entity.node.canonical', ['node' => $file->nid])),
+        'title' => Link::createFromRoute($file->title, 'entity.node.canonical', ['node' => $file->nid])->toString(),
         'model' => SafeMarkup::checkPlain($file->model),
       );
     }
@@ -172,7 +173,7 @@ class ShowForm extends FormBase {
     $form = $variables['form'];
 
     // Render everything.
-    $output = '<p>' . $this->t('File downloads can be attached to any Ubercart product as a product feature. For security reasons the <a href=":download_url">file downloads directory</a> is separated from the Drupal <a href=":file_url">file system</a>. Below is the list of files (and their associated Ubercart products, if any) that can be used for file downloads.', [':download_url' => Url::fromRoute('uc_product.admin', [], ['query' => ['destination' => 'admin/store/products/files']])->toString(), ':file_url' => Url::fromRoute('system.file_system_settings')->toString())) . '</p>';
+    $output = '<p>' . $this->t('File downloads can be attached to any Ubercart product as a product feature. For security reasons the <a href=":download_url">file downloads directory</a> is separated from the Drupal <a href=":file_url">file system</a>. Below is the list of files (and their associated Ubercart products, if any) that can be used for file downloads.', [':download_url' => Url::fromRoute('uc_product.admin', [], ['query' => ['destination' => 'admin/store/products/files']])->toString(), ':file_url' => Url::fromRoute('system.file_system_settings')->toString()]) . '</p>';
     $output .= drupal_render($form['uc_file_action']);
     $output .= drupal_render($form['file_select']);
     $output .= theme('pager');
diff --git a/uc_order/src/Form/OrderStatusAddForm.php b/uc_order/src/Form/OrderStatusAddForm.php
index ac36450..3dec37a 100644
--- a/uc_order/src/Form/OrderStatusAddForm.php
+++ b/uc_order/src/Form/OrderStatusAddForm.php
@@ -9,7 +9,7 @@ namespace Drupal\uc_order\Form;
 
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Url;
+use Drupal\Core\Link;
 use Drupal\uc_order\Entity\OrderStatus;
 
 /**
@@ -67,7 +67,7 @@ class OrderStatusAddForm extends FormBase {
       '#value' => $this->t('Create'),
     );
     $form['actions']['cancel'] = array(
-      '#markup' => $this->l($this->t('Cancel'), Url::fromRoute('uc_order.status_add')),
+      '#markup' => Link::createFromRoute($this->t('Cancel'), 'uc_order.status_add')->toString(),
     );
 
     return $form;
diff --git a/uc_report/src/Controller/Reports.php b/uc_report/src/Controller/Reports.php
index 4e1a0fa..c9d78c7 100644
--- a/uc_report/src/Controller/Reports.php
+++ b/uc_report/src/Controller/Reports.php
@@ -8,6 +8,7 @@
 namespace Drupal\uc_report\Controller;
 
 use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\Link;
 use Drupal\Core\Url;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 
@@ -38,7 +39,7 @@ class Reports extends ControllerBase {
     );
     $csv_rows[] = array($this->t('#'), $this->t('Customer'), $this->t('Username'), $this->t('Orders'), $this->t('Products'), $this->t('Total'), $this->t('Average'));
 
-    $query = db_select('users_field_data', 'u', array('fetch' => \PDO::FETCH_ASSOC))
+    $query = db_select('users_field_data', 'u', ['fetch' => \PDO::FETCH_ASSOC])
       ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
       ->extend('Drupal\Core\Database\Query\TableSortExtender');
     $query->leftJoin('uc_orders', 'ou', 'u.uid = ou.uid');
@@ -52,10 +53,10 @@ class Reports extends ControllerBase {
       ))
       ->condition('u.uid', 0, '>')
       ->groupBy('u.uid');
-    $query->addExpression("(SELECT COUNT(DISTINCT(order_id)) FROM {uc_orders} o WHERE o.uid = u.uid AND o.order_status IN (:statuses[]))", 'orders', array(':statuses[]' => $order_statuses));
-    $query->addExpression("(SELECT SUM(qty) FROM {uc_order_products} ps LEFT JOIN {uc_orders} os ON ps.order_id = os.order_id WHERE os.order_status IN (:statuses2[]) AND os.uid = u.uid)", 'products', array(':statuses2[]' => $order_statuses));
-    $query->addExpression("(SELECT SUM(ot.order_total) FROM {uc_orders} ot WHERE ot.uid = u.uid AND ot.order_status IN (:statuses3[]))", 'total', array(':statuses3[]' => $order_statuses));
-    $query->addExpression("ROUND((SELECT SUM(ot.order_total) FROM {uc_orders} ot WHERE ot.uid = u.uid AND ot.order_status IN (:sum_statuses[]))/(SELECT COUNT(DISTINCT(order_id)) FROM {uc_orders} o WHERE o.uid = u.uid AND o.order_status IN (:count_statuses[])), 2)", 'average', array(':sum_statuses[]' => $order_statuses, ':count_statuses[]' => $order_statuses));
+    $query->addExpression("(SELECT COUNT(DISTINCT(order_id)) FROM {uc_orders} o WHERE o.uid = u.uid AND o.order_status IN (:statuses[]))", 'orders', [':statuses[]' => $order_statuses]);
+    $query->addExpression("(SELECT SUM(qty) FROM {uc_order_products} ps LEFT JOIN {uc_orders} os ON ps.order_id = os.order_id WHERE os.order_status IN (:statuses2[]) AND os.uid = u.uid)", 'products', [':statuses2[]' => $order_statuses]);
+    $query->addExpression("(SELECT SUM(ot.order_total) FROM {uc_orders} ot WHERE ot.uid = u.uid AND ot.order_status IN (:statuses3[]))", 'total', [':statuses3[]' => $order_statuses]);
+    $query->addExpression("ROUND((SELECT SUM(ot.order_total) FROM {uc_orders} ot WHERE ot.uid = u.uid AND ot.order_status IN (:sum_statuses[]))/(SELECT COUNT(DISTINCT(order_id)) FROM {uc_orders} o WHERE o.uid = u.uid AND o.order_status IN (:count_statuses[])), 2)", 'average', [':sum_statuses[]' => $order_statuses, ':count_statuses[]' => $order_statuses]);
 
     $count_query = db_select('users_field_data', 'u');
     $count_query->leftJoin('uc_orders', 'ou', 'u.uid = ou.uid');
@@ -73,7 +74,7 @@ class Reports extends ControllerBase {
     $customers = $query->execute();
 
     foreach ($customers as $customer) {
-      $name = (!empty($customer[$last_name]) || !empty($customer[$first_name])) ? $this->l($customer[$last_name] . ', ' . $customer[$first_name], Url::fromUri('base:admin/store/customers/orders/' . $customer['uid'])) : $this->l($customer['name'], Url::fromUri('base:admin/store/customers/orders/' . $customer['uid']));
+      $name = (!empty($customer[$last_name]) || !empty($customer[$first_name])) ? Link::fromTextAndUrl($customer[$last_name] . ', ' . $customer[$first_name], Url::fromUri('base:admin/store/customers/orders/' . $customer['uid']))->toString() : Link::fromTextAndUrl($customer['name'], Url::fromUri('base:admin/store/customers/orders/' . $customer['uid']))->toString();
       $customer_number = ($page * variable_get('uc_report_table_size', 30)) + (count($rows) + 1);
       $customer_order_name = (!empty($customer[$last_name]) || !empty($customer[$first_name])) ? $customer[$last_name] . ', ' . $customer[$first_name] : $customer['name'];
       $customer_name = $customer['name'];
@@ -84,7 +85,7 @@ class Reports extends ControllerBase {
       $rows[] = array(
         array('data' => $customer_number),
         array('data' => $name),
-        array('data' => $this->l($customer_name, Url::fromRoute('entity.user.canonical', ['user' => $customer['uid']]))),
+        array('data' => Link::createFromRoute($customer_name, 'entity.user.canonical', ['user' => $customer['uid']])->toString()),
         array('data' => $orders),
         array('data' => $products),
         array('data' => $total_revenue),
@@ -109,17 +110,17 @@ class Reports extends ControllerBase {
       '#suffix' => '</div>',
     );
     $build['links']['export_csv'] = array(
-      '#markup' => $this->l($this->t('Export to CSV file.'), Url::fromRoute('uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])),
+      '#markup' => Link::createFromRoute($this->t('Export to CSV file.'), 'uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])->toString(),
       '#suffix' => '&nbsp;&nbsp;&nbsp;',
     );
     if (isset($_GET['nopage'])) {
       $build['links']['toggle_pager'] = array(
-        '#markup' => $this->l($this->t('Show paged records'), Url::fromUri('base:admin/store/reports/customers')),
+        '#markup' => Link::createFromRoute($this->t('Show paged records'), 'uc_report.customers')->toString(),
       );
     }
     else {
       $build['links']['toggle_pager'] = array(
-        '#markup' => $this->l($this->t('Show all records'), Url::fromUri('base:admin/store/reports/customers', array('query' => array('nopage' => '1')))),
+        '#markup' => Link::createFromRoute($this->t('Show all records'), 'uc_report.customers', ['query' => ['nopage' => '1']])->toString(),
       );
     }
 
@@ -151,16 +152,16 @@ class Reports extends ControllerBase {
       }
     }
 
-    $query = db_select('node_field_data', 'n', array('fetch' => \PDO::FETCH_ASSOC))
+    $query = db_select('node_field_data', 'n', ['fetch' => \PDO::FETCH_ASSOC])
       ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
       ->extend('Drupal\Core\Database\Query\TableSortExtender')
       ->limit($page_size);
 
     $query->addField('n', 'nid');
     $query->addField('n', 'title');
-    $query->addExpression("(SELECT SUM(uop.qty) FROM {uc_order_products} uop LEFT JOIN {uc_orders} uo ON uop.order_id = uo.order_id WHERE uo.order_status IN (:statuses[]) AND uop.nid = n.nid)", 'sold', array(':statuses[]' => $order_statuses));
-    $query->addExpression("(SELECT (SUM(uop.price * uop.qty) - SUM(uop.cost * uop.qty)) FROM {uc_order_products} uop LEFT JOIN {uc_orders} uo ON uop.order_id = uo.order_id WHERE uo.order_status IN (:statuses2[]) AND uop.nid = n.nid)", 'gross', array(':statuses2[]' => $order_statuses));
-    $query->addExpression("(SELECT (SUM(uop.price * uop.qty)) FROM {uc_order_products} uop LEFT JOIN {uc_orders} uo ON uop.order_id = uo.order_id WHERE uo.order_status IN (:statuses3[]) AND uop.nid = n.nid)", 'revenue', array(':statuses3[]' => $order_statuses));
+    $query->addExpression("(SELECT SUM(uop.qty) FROM {uc_order_products} uop LEFT JOIN {uc_orders} uo ON uop.order_id = uo.order_id WHERE uo.order_status IN (:statuses[]) AND uop.nid = n.nid)", 'sold', [':statuses[]' => $order_statuses]);
+    $query->addExpression("(SELECT (SUM(uop.price * uop.qty) - SUM(uop.cost * uop.qty)) FROM {uc_order_products} uop LEFT JOIN {uc_orders} uo ON uop.order_id = uo.order_id WHERE uo.order_status IN (:statuses2[]) AND uop.nid = n.nid)", 'gross', [':statuses2[]' => $order_statuses]);
+    $query->addExpression("(SELECT (SUM(uop.price * uop.qty)) FROM {uc_order_products} uop LEFT JOIN {uc_orders} uo ON uop.order_id = uo.order_id WHERE uo.order_status IN (:statuses3[]) AND uop.nid = n.nid)", 'revenue', [':statuses3[]' => $order_statuses]);
 
     $header = array(
       array('data' => t('#')),
@@ -189,7 +190,7 @@ class Reports extends ControllerBase {
 
     $products = $query->execute();
     foreach ($products as $product) {
-      $product_cell = $this->l($product['title'], Url::fromRoute('entity.node.canonical', ['node' => $product['nid']]));
+      $product_cell = Link::createFromRoute($product['title'], 'entity.node.canonical', ['node' => $product['nid']])->toString();
       $product_csv = $product['title'];
       $sold_cell = empty($product['sold']) ? 0 : $product['sold'];
       $sold_csv = $sold_cell;
@@ -224,9 +225,9 @@ class Reports extends ControllerBase {
         $models = uc_report_product_get_skus($product['nid']);
         // Add the product breakdown rows
         foreach ($models as $model) {
-          $sold = db_query("SELECT SUM(qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid", array(':statuses[]' => $order_statuses, ':model' => $model, ':nid' => $product['nid']))->fetchField();
-          $revenue = db_query("SELECT SUM(p.price * p.qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid", array(':statuses[]' => $order_statuses, ':model' => $model, ':nid' => $product['nid']))->fetchField();
-          $gross = db_query("SELECT (SUM(p.price * p.qty) - SUM(p.cost * p.qty)) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid", array(':statuses[]' => $order_statuses, ':model' => $model, ':nid' => $product['nid']))->fetchField();
+          $sold = db_query("SELECT SUM(qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid", [':statuses[]' => $order_statuses, ':model' => $model, ':nid' => $product['nid']])->fetchField();
+          $revenue = db_query("SELECT SUM(p.price * p.qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid", [':statuses[]' => $order_statuses, ':model' => $model, ':nid' => $product['nid']])->fetchField();
+          $gross = db_query("SELECT (SUM(p.price * p.qty) - SUM(p.cost * p.qty)) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid", [':statuses[]' => $order_statuses, ':model' => $model, ':nid' => $product['nid']])->fetchField();
           $breakdown_product = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$model";
           $product_csv = "     $model";
 
@@ -285,17 +286,17 @@ class Reports extends ControllerBase {
       '#suffix' => '</div>',
     );
     $build['links']['export_csv'] = array(
-      '#markup' => $this->l(t('Export to CSV file.'), Url::fromRoute('uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])),
+      '#markup' => Link::createFromRoute(t('Export to CSV file.'), 'uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])->toString(),
       '#suffix' => '&nbsp;&nbsp;&nbsp;',
     );
     if (isset($_GET['nopage'])) {
       $build['links']['toggle_pager'] = array(
-        '#markup' => $this->l(t('Show paged records'), Url::fromRoute('uc_report.products')),
+        '#markup' => Link::createFromRoute(t('Show paged records'), 'uc_report.products')->toString(),
       );
     }
     else {
       $build['links']['toggle_pager'] = array(
-        '#markup' => $this->l(t('Show all records'), Url::fromRoute('uc_report.products', ['query' => ['nopage' => '1']])),
+        '#markup' => Link::createFromRoute(t('Show all records'), 'uc_report.products', ['query' => ['nopage' => '1']])->toString(),
       );
     }
     $build['instructions'] = array('#markup' => '<small>*' . t('Make sure %setting_name is set to %state in the <a href=":url">access log settings page</a> to enable views column.', ['%setting_name' => 'count content views', '%state' => 'enabled', ':url' => Url::fromUri('base:admin/config/system/statistics', ['query' => ['destination' => 'admin/store/reports/products']])->toString()]) . '</small>');
@@ -367,7 +368,7 @@ class Reports extends ControllerBase {
       );
     }
 
-    $query = db_select('node', 'n', array('fetch' => \PDO::FETCH_ASSOC))
+    $query = db_select('node', 'n', ['fetch' => \PDO::FETCH_ASSOC])
       ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
       ->extend('Drupal\Core\Database\Query\TableSortExtender')
       ->limit($page_size)
@@ -378,9 +379,9 @@ class Reports extends ControllerBase {
       ->condition('type', $product_types, 'IN')
       ->groupBy('n.nid');
 
-    $query->addExpression("(SELECT SUM(qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.nid = n.nid AND o.created >= :start AND o.created <= :end)", 'sold', array(':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']));
-    $query->addExpression("(SELECT (SUM(p2.price * p2.qty)) FROM {uc_order_products} p2 LEFT JOIN {uc_orders} o ON p2.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p2.nid = n.nid AND o.created >= :start AND o.created <= :end)", 'revenue', array(':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']));
-    $query->addExpression("(SELECT (SUM(p3.price * p3.qty) - SUM(p3.cost * p3.qty)) FROM {uc_order_products} p3 LEFT JOIN {uc_orders} o ON p3.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p3.nid = n.nid AND o.created >= :start AND o.created <= :end)", 'gross', array(':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']));
+    $query->addExpression("(SELECT SUM(qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.nid = n.nid AND o.created >= :start AND o.created <= :end)", 'sold', [':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']]);
+    $query->addExpression("(SELECT (SUM(p2.price * p2.qty)) FROM {uc_order_products} p2 LEFT JOIN {uc_orders} o ON p2.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p2.nid = n.nid AND o.created >= :start AND o.created <= :end)", 'revenue', [':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']]);
+    $query->addExpression("(SELECT (SUM(p3.price * p3.qty) - SUM(p3.cost * p3.qty)) FROM {uc_order_products} p3 LEFT JOIN {uc_orders} o ON p3.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p3.nid = n.nid AND o.created >= :start AND o.created <= :end)", 'gross', [':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']]);
 
     $header = array(
       array('data' => t('#')),
@@ -406,7 +407,7 @@ class Reports extends ControllerBase {
     $products = $query->execute();
     foreach ($products as $product) {
       $row_cell = ($page * variable_get('uc_report_table_size', 30)) + count($rows) + 1;
-      $product_cell = $this->l($product['title'], Url::fromRoute('entity.node.canonical', ['node' => $product['nid']]));
+      $product_cell = Link::createFromRoute($product['title'], 'entity.node.canonical', ['node' => $product['nid']])->toString();
       $product_csv = $product['title'];
       $sold_cell = empty($product['sold']) ? 0 : $product['sold'];
       $sold_csv = $sold_cell;
@@ -422,11 +423,11 @@ class Reports extends ControllerBase {
         $models = uc_report_product_get_skus($product['nid']);
         // Add the product breakdown rows
         foreach ($models as $model) {
-          $sold = db_query("SELECT SUM(qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid AND o.created >= :start AND o.created <= :end", array(':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date'], ':model' => $model, ':nid' => $product['nid']))->fetchField();
+          $sold = db_query("SELECT SUM(qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid AND o.created >= :start AND o.created <= :end", [':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date'], ':model' => $model, ':nid' => $product['nid']])->fetchField();
           $sold = empty($sold) ? 0 : $sold;
-          $revenue = db_query("SELECT SUM(p.price * p.qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid AND o.created >= :start AND o.created <= :end", array(':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date'], ':model' => $model, ':nid' => $product['nid']))->fetchField();
+          $revenue = db_query("SELECT SUM(p.price * p.qty) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid AND o.created >= :start AND o.created <= :end", [':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date'], ':model' => $model, ':nid' => $product['nid']])->fetchField();
           $revenue = empty($revenue) ? 0 : $revenue;
-          $gross = db_query("SELECT (SUM(p.price * p.qty) - SUM(p.cost * p.qty)) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid AND o.created >= :start AND o.created <= :end", array(':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date'], ':model' => $model, ':nid' => $product['nid']))->fetchField();
+          $gross = db_query("SELECT (SUM(p.price * p.qty) - SUM(p.cost * p.qty)) FROM {uc_order_products} p LEFT JOIN {uc_orders} o ON p.order_id = o.order_id WHERE o.order_status IN (:statuses[]) AND p.model = :model AND p.nid = :nid AND o.created >= :start AND o.created <= :end", [':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date'], ':model' => $model, ':nid' => $product['nid']])->fetchField();
           $gross = empty($gross) ? 0 : $gross;
 
           $breakdown_product .= "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$model";
@@ -488,17 +489,17 @@ class Reports extends ControllerBase {
       '#suffix' => '</div>',
     );
     $build['links']['export_csv'] = array(
-      '#markup' => $this->l(t('Export to CSV file.'), Url::fromRoute('uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])),
+      '#markup' => Link::createFromRoute(t('Export to CSV file.'), 'uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])->toString(),
       '#suffix' => '&nbsp;&nbsp;&nbsp;',
     );
     if (isset($_GET['nopage'])) {
       $build['links']['toggle_pager'] = array(
-        '#markup' => $this->l(t('Show paged records'), Url::fromUri('base:admin/store/reports/products/custom')),
+        '#markup' => Link::createFromRoute(t('Show paged records'), 'uc_reports.custom_report')->toString(),
       );
     }
     else {
       $build['links']['toggle_pager'] = array(
-        '#markup' => $this->l(t('Show all records'), Url::fromUri('base:admin/store/reports/products/custom', array('query' => array('nopage' => '1')))),
+        '#markup' => Link::createFromRoute(t('Show all records'), 'uc_reports.custom_report', ['query' => ['nopage' => '1']])->toString(),
       );
     }
 
@@ -527,7 +528,7 @@ class Reports extends ControllerBase {
     $today = self::get_sales($today_start);
 
     $rows[] = array(
-      $this->l(t('Today, !date', array('!date' => \Drupal::service('date.formatter')->format($today_start, 'uc_store'))), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . $today_start . '/' . $today_end)),
+      Link::fromTextAndUrl(t('Today, @date', ['@date' => \Drupal::service('date.formatter')->format($today_start, 'uc_store')]), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . $today_start . '/' . $today_end))->toString(),
       $today['total'],
       array('data' => array('#theme' => 'uc_price', '#price' => $today['income'])),
       array('data' => array('#theme' => 'uc_price', '#price' => $today['average'])),
@@ -537,7 +538,7 @@ class Reports extends ControllerBase {
     $yesterday = self::get_sales($today_start - 86400);
 
     $rows[] = array(
-      $this->l(t('Yesterday, !date', array('!date' => \Drupal::service('date.formatter')->format($today_start - 86400, 'uc_store'))), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . ($today_start - 86400) . '/' . ($today_end - 86400))),
+      Link::fromTextAndUrl(t('Yesterday, @date', ['@date' => \Drupal::service('date.formatter')->format($today_start - 86400, 'uc_store')]), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . ($today_start - 86400) . '/' . ($today_end - 86400)))->toString(),
       $yesterday['total'],
       array('data' => array('#theme' => 'uc_price', '#price' => $yesterday['income'])),
       array('data' => array('#theme' => 'uc_price', '#price' => $yesterday['average'])),
@@ -549,7 +550,7 @@ class Reports extends ControllerBase {
 
     // Add the month-to-date details to the report table.
     $rows[] = array(
-      $this->l(t('Month-to-date, @month', array('@month' => $month_title)), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . $month_start . '/' . $month_end)),
+      Link::fromTextAndUrl(t('Month-to-date, @month', ['@month' => $month_title]), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . $month_start . '/' . $month_end))->toString(),
       $month['total'],
       array('data' => array('#theme' => 'uc_price', '#price' => $month['income'])),
       array('data' => array('#theme' => 'uc_price', '#price' => $month['average'])),
@@ -568,7 +569,7 @@ class Reports extends ControllerBase {
 
     // Add the daily averages for the month to the report table.
     $rows[] = array(
-      t('Daily average for @month', array('@month' => $month_title)),
+      t('Daily average for @month', ['@month' => $month_title]),
       $daily_orders,
       array('data' => array('#theme' => 'uc_price', '#price' => $daily_revenue)),
       '',
@@ -579,7 +580,7 @@ class Reports extends ControllerBase {
 
     // Add the projected totals for the month to the report table.
     $rows[] = array(
-      t('Projected totals for @date', array('@date' => $month_title)),
+      t('Projected totals for @date', ['@date' => $month_title]),
       round($month['total'] + ($daily_orders * $remaining_days), 2),
       array('data' => array('#theme' => 'uc_price', '#price' => round($month['income'] + ($daily_revenue * $remaining_days), 2))),
       '',
@@ -597,10 +598,10 @@ class Reports extends ControllerBase {
     $header = array(array('data' => t('Statistics'), 'width' => '50%'), '');
 
     $rows = array(
-      array(array('data' => t('Grand total sales')), array('data' => array('#theme' => 'uc_price', '#price' => db_query("SELECT SUM(order_total) FROM {uc_orders} WHERE order_status IN (:statuses[])", array(':statuses[]' => $order_statuses))->fetchField()))),
-      array(array('data' => t('Customers total')), array('data' => db_query("SELECT COUNT(DISTINCT uid) FROM {uc_orders} WHERE order_status IN (:statuses[])", array(':statuses[]' => $order_statuses))->fetchField())),
-      array(array('data' => t('New customers today')), array('data' => db_query("SELECT COUNT(DISTINCT uid) FROM {uc_orders} WHERE order_status IN (:statuses[]) AND :start <= created AND created <= :end", array(':statuses[]' => $order_statuses, ':start' => $today_start, ':end' => $today_end))->fetchField())),
-      array(array('data' => t('Online customers')), array('data' => db_query("SELECT COUNT(DISTINCT s.uid) FROM {sessions} s LEFT JOIN {uc_orders} o ON s.uid = o.uid WHERE s.uid > 0 AND o.order_status IN (:statuses[])", array(':statuses[]' => $order_statuses))->fetchField())),
+      array(array('data' => t('Grand total sales')), array('data' => array('#theme' => 'uc_price', '#price' => db_query("SELECT SUM(order_total) FROM {uc_orders} WHERE order_status IN (:statuses[])", [':statuses[]' => $order_statuses])->fetchField()))),
+      array(array('data' => t('Customers total')), array('data' => db_query("SELECT COUNT(DISTINCT uid) FROM {uc_orders} WHERE order_status IN (:statuses[])", [':statuses[]' => $order_statuses])->fetchField())),
+      array(array('data' => t('New customers today')), array('data' => db_query("SELECT COUNT(DISTINCT uid) FROM {uc_orders} WHERE order_status IN (:statuses[]) AND :start <= created AND created <= :end", [':statuses[]' => $order_statuses, ':start' => $today_start, ':end' => $today_end])->fetchField())),
+      array(array('data' => t('Online customers')), array('data' => db_query("SELECT COUNT(DISTINCT s.uid) FROM {sessions} s LEFT JOIN {uc_orders} o ON s.uid = o.uid WHERE s.uid > 0 AND o.order_status IN (:statuses[])", [':statuses[]' => $order_statuses])->fetchField())),
     );
 
     // Add the statistics table to the output.
@@ -623,7 +624,7 @@ class Reports extends ControllerBase {
       if (!empty($status['title'])) {
         // Add the total number of orders with this status to the table.
         $rows[] = array(
-          $this->l($status['title'], Url::fromUri('base:admin/store/orders/view', ['query' => ['order_status' => $status['order_status_id']]])),
+          Link::fromTextAndUrl($status['title'], Url::fromUri('base:admin/store/orders/view', ['query' => ['order_status' => $status['order_status_id']]]))->toString(),
           $status['order_count'],
         );
       }
@@ -690,7 +691,7 @@ class Reports extends ControllerBase {
 
       // Add the month's row to the report table.
       $rows[] = array(
-        $this->l(date('M Y', $month_start), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . $month_start . '/' . $month_end)),
+        Link::fromTextAndUrl(date('M Y', $month_start), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . $month_start . '/' . $month_end))->toString(),
         $month_sales['total'],
         uc_currency_format($month_sales['income']),
         uc_currency_format($month_average),
@@ -722,7 +723,7 @@ class Reports extends ControllerBase {
 
     // Add the total row to the report table.
     $rows[] = array(
-      $this->l(t('Total @year', array('@year' => $year)), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . $year_start . '/' . $year_end)),
+      Link::fromTextAndUrl(t('Total @year', ['@year' => $year]), Url::fromUri('base:admin/store/orders/search/results/0/0/0/0/0/0/' . $year_start . '/' . $year_end))->toString(),
       $year_sales['total'],
       uc_currency_format($year_sales['income']),
       uc_currency_format($year_average),
@@ -730,7 +731,7 @@ class Reports extends ControllerBase {
 
     // Add the total data to the CSV export.
     $csv_rows[] = array(
-      t('Total @year', array('@year' => $year)),
+      t('Total @year', ['@year' => $year]),
       $year_sales['total'],
       $year_sales['income'],
       $year_average,
@@ -753,7 +754,7 @@ class Reports extends ControllerBase {
       '#suffix' => '</div>',
     );
     $build['links']['export_csv'] = array(
-      '#markup' => $this->l(t('Export to CSV file.'), Url::fromRoute('uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])),
+      '#markup' => Link::createFromRoute(t('Export to CSV file.'), 'uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])->toString(),
     );
 
     return $build;
@@ -806,12 +807,12 @@ class Reports extends ControllerBase {
       }
 
       // Build the order data for the subreport.
-      $result = db_query("SELECT COUNT(*) as count, title FROM {uc_orders} LEFT JOIN {uc_order_statuses} ON order_status_id = order_status WHERE :start <= created AND created <= :end AND order_status IN (:statuses[]) GROUP BY order_status, {uc_order_statuses}.title, {uc_order_statuses}.weight ORDER BY weight ASC", array(':statuses[]' => $args['status'], ':start' => $subreport['start'], ':end' => $subreport['end']));
+      $result = db_query("SELECT COUNT(*) as count, title FROM {uc_orders} LEFT JOIN {uc_order_statuses} ON order_status_id = order_status WHERE :start <= created AND created <= :end AND order_status IN (:statuses[]) GROUP BY order_status, {uc_order_statuses}.title, {uc_order_statuses}.weight ORDER BY weight ASC", [':statuses[]' => $args['status'], ':start' => $subreport['start'], ':end' => $subreport['end']]);
       $statuses = array();
 
       // Put the order counts into an array by status.
       foreach ($result as $status) {
-        $statuses[] = t('@count - @title', array('@count' => $status->count, '@title' => $status->title));
+        $statuses[] = t('@count - @title', ['@count' => $status->count, '@title' => $status->title]);
       }
 
       $order_data = implode('<br />', $statuses);
@@ -820,20 +821,20 @@ class Reports extends ControllerBase {
       // Build the product data for the subreport.
       if ($args['detail']) {
         // Grab the detailed product breakdown if selected.
-        $result = db_query("SELECT SUM(op.qty) as count, n.title, n.nid FROM {uc_order_products} op LEFT JOIN {uc_orders} o ON o.order_id = op.order_id LEFT JOIN {node_field_data} n ON n.nid = op.nid WHERE :start <= o.created AND o.created <= :end AND o.order_status IN (:statuses[]) GROUP BY n.nid ORDER BY count DESC, n.title ASC", array(':statuses[]' => $args['status'], ':start' => $subreport['start'], ':end' => $subreport['end']));
+        $result = db_query("SELECT SUM(op.qty) as count, n.title, n.nid FROM {uc_order_products} op LEFT JOIN {uc_orders} o ON o.order_id = op.order_id LEFT JOIN {node_field_data} n ON n.nid = op.nid WHERE :start <= o.created AND o.created <= :end AND o.order_status IN (:statuses[]) GROUP BY n.nid ORDER BY count DESC, n.title ASC", [':statuses[]' => $args['status'], ':start' => $subreport['start'], ':end' => $subreport['end']]);
         foreach ($result as $product_breakdown) {
-          $product_data .= $product_breakdown->count . ' x ' . $this->l($product_breakdown->title, Url::fromRoute('entity.node.canonical', ['node' => $product_breakdown->nid])) . "<br />\n";
+          $product_data .= $product_breakdown->count . ' x ' . Link::createFromRoute($product_breakdown->title, 'entity.node.canonical', ['node' => $product_breakdown->nid])->toString() . "<br />\n";
           $product_csv .= $product_breakdown->count . ' x ' . $product_breakdown->title . "\n";
         }
       }
       else {
         // Otherwise just display the total number of products sold.
-        $product_data = db_query("SELECT SUM(qty) FROM {uc_orders} o LEFT JOIN {uc_order_products} op ON o.order_id = op.order_id WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", array(':statuses[]' => $args['status'], ':start' => $subreport['start'], ':end' => $subreport['end']))->fetchField();
+        $product_data = db_query("SELECT SUM(qty) FROM {uc_orders} o LEFT JOIN {uc_order_products} op ON o.order_id = op.order_id WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", [':statuses[]' => $args['status'], ':start' => $subreport['start'], ':end' => $subreport['end']])->fetchField();
         $product_csv = $product_data;
       }
 
       // Tally up the revenue from the orders.
-      $revenue_count = db_query("SELECT SUM(order_total) FROM {uc_orders} WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", array(':statuses[]' => $args['status'], ':start' => $subreport['start'], ':end' => $subreport['end']))->fetchField();
+      $revenue_count = db_query("SELECT SUM(order_total) FROM {uc_orders} WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", [':statuses[]' => $args['status'], ':start' => $subreport['start'], ':end' => $subreport['end']])->fetchField();
 
       // Add the subreport's row to the report table.
       $rows[] = array(
@@ -853,9 +854,9 @@ class Reports extends ControllerBase {
     }
 
     // Calculate the totals for the report.
-    $order_total = db_query("SELECT COUNT(*) FROM {uc_orders} WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", array(':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']))->fetchField();
-    $product_total = db_query("SELECT SUM(qty) FROM {uc_orders} o LEFT JOIN {uc_order_products} op ON o.order_id = op.order_id WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", array(':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']))->fetchField();
-    $revenue_total = db_query("SELECT SUM(order_total) FROM {uc_orders} WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", array(':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']))->fetchField();
+    $order_total = db_query("SELECT COUNT(*) FROM {uc_orders} WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", [':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']])->fetchField();
+    $product_total = db_query("SELECT SUM(qty) FROM {uc_orders} o LEFT JOIN {uc_order_products} op ON o.order_id = op.order_id WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", [':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']])->fetchField();
+    $revenue_total = db_query("SELECT SUM(order_total) FROM {uc_orders} WHERE :start <= created AND created <= :end AND order_status IN (:statuses[])", [':statuses[]' => $args['status'], ':start' => $args['start_date'], ':end' => $args['end_date']])->fetchField();
 
     // Add the total row to the report table.
     $rows[] = array(
@@ -889,7 +890,7 @@ class Reports extends ControllerBase {
       '#suffix' => '</div>',
     );
     $build['links']['export_csv'] = array(
-      '#markup' => $this->l(t('Export to CSV file.'), Url::fromRoute('uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])),
+      '#markup' => Link::createFromRoute(t('Export to CSV file.'), 'uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])->toString(),
     );
 
     return $build;
@@ -986,13 +987,13 @@ class Reports extends ControllerBase {
 
     // Get the total value of the orders.
     $output = array('income' => 0);
-    $orders = db_query("SELECT o.order_total FROM {uc_orders} o WHERE o.order_status IN (:statuses[]) AND :start <= created AND created <= :end", array(':statuses[]' => $order_statuses, ':start' => $start, ':end' => $end));
+    $orders = db_query("SELECT o.order_total FROM {uc_orders} o WHERE o.order_status IN (:statuses[]) AND :start <= created AND created <= :end", [':statuses[]' => $order_statuses, ':start' => $start, ':end' => $end]);
     while ($order = $orders->fetchObject()) {
       $output['income'] += $order->order_total;
     }
 
     // Get the total amount of orders.
-    $count = db_query("SELECT COUNT(o.order_total) FROM {uc_orders} o WHERE o.order_status IN (:statuses[]) AND :start <= created AND created <= :end", array(':statuses[]' => $order_statuses, ':start' => $start, ':end' => $end))->fetchField();
+    $count = db_query("SELECT COUNT(o.order_total) FROM {uc_orders} o WHERE o.order_status IN (:statuses[]) AND :start <= created AND created <= :end", [':statuses[]' => $order_statuses, ':start' => $start, ':end' => $end])->fetchField();
     $output['total'] = $count;
 
     // Average for this period.
diff --git a/uc_role/src/Form/RoleFeatureForm.php b/uc_role/src/Form/RoleFeatureForm.php
index b6e9c0c..47e1d61 100644
--- a/uc_role/src/Form/RoleFeatureForm.php
+++ b/uc_role/src/Form/RoleFeatureForm.php
@@ -9,6 +9,7 @@ namespace Drupal\uc_role\Form;
 
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Link;
 use Drupal\Core\Url;
 use Drupal\node\NodeInterface;
 
@@ -88,7 +89,7 @@ class RoleFeatureForm extends FormBase {
       unset($form['buttons']);
 
       $form['no_roles'] = array(
-        '#markup' => $this->t('You need to <a href=":url">create new roles</a> before any can be added as product features.', [':url' => $this->url('user.role_add', [], ['query' => ['destination' => 'admin/store/config/products']])]),
+        '#markup' => $this->t('You need to <a href=":url">create new roles</a> before any can be added as product features.', [':url' => Url::fromRoute('user.role_add', [], ['query' => ['destination' => 'admin/store/config/products']])->toString()]),
         '#prefix' => '<p>',
         '#suffix' => '</p>',
       );
@@ -123,7 +124,7 @@ class RoleFeatureForm extends FormBase {
 
     $form['end_override'] = array(
       '#type' => 'checkbox',
-      '#title' => $this->t('Override the <a href=":url">default role expiration</a>.', [':url' => $this->url('uc_product.settings')]),
+      '#title' => $this->t('Override the <a href=":url">default role expiration</a>.', [':url' => Url::fromRoute('uc_product.settings')->toString()]),
       '#default_value' => $default_end_override,
     );
 
@@ -228,7 +229,7 @@ class RoleFeatureForm extends FormBase {
 
     // No roles?
     if ($form_state->isValueEmpty('uc_role_role')) {
-      $form_state->setErrorByName('uc_role_role', $this->t('You must have a role to assign. You may need to <a href=":role_url">create a new role</a> or perhaps <a href=":feature_url">set role assignment defaults</a>.', [':role_url' => $this->url('user.role_add'), ':feature_url' => $this->url('uc_product.settings')]));
+      $form_state->setErrorByName('uc_role_role', $this->t('You must have a role to assign. You may need to <a href=":role_url">create a new role</a> or perhaps <a href=":feature_url">set role assignment defaults</a>.', [':role_url' => Url::fromRoute('user.role_add')->toString(), ':feature_url' => Url::fromRoute('uc_product.settings')->toString()]));
     }
 
     // This role already set on this SKU?
@@ -288,7 +289,7 @@ class RoleFeatureForm extends FormBase {
       }
     }
     else {
-      $description .= $this->t('<strong>Expiration:</strong> @link (not overridden)<br />', ['@link' => $this->l(t('Global expiration'), Url::fromRoute('uc_product.settings'))]);
+      $description .= $this->t('<strong>Expiration:</strong> @link (not overridden)<br />', ['@link' => Link::createFromRoute(t('Global expiration'), 'uc_product.settings')->toString()]);
     }
     $description .= $product_role['shippable'] ? $this->t('<strong>Shippable:</strong> Yes<br />') : $this->t('<strong>Shippable:</strong> No<br />');
     $description .= $product_role['by_quantity'] ? $this->t('<strong>Multiply by quantity:</strong> Yes') : $this->t('<strong>Multiply by quantity:</strong> No');
diff --git a/uc_role/src/Form/RoleSettingsForm.php b/uc_role/src/Form/RoleSettingsForm.php
index ef6d47e..186dfed 100644
--- a/uc_role/src/Form/RoleSettingsForm.php
+++ b/uc_role/src/Form/RoleSettingsForm.php
@@ -10,6 +10,7 @@ namespace Drupal\uc_role\Form;
 use Drupal\Core\Datetime\DrupalDateTime;
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
 
 
 /**
@@ -48,7 +49,7 @@ class RoleSettingsForm extends ConfigFormBase {
 
     if (!count($default_role_choices)) {
       $form['no_roles'] = array(
-        '#markup' => $this->t('You need to <a href=":url">create new roles</a> before any can be added as product features.', [':url' => $this->url('user.role_add', [], ['query' => ['destination' => 'admin/store/config/products']])]),
+        '#markup' => $this->t('You need to <a href=":url">create new roles</a> before any can be added as product features.', [':url' => Url::fromRoute('user.role_add', [], ['query' => ['destination' => 'admin/store/config/products']])->toString()]),
         '#prefix' => '<p>',
         '#suffix' => '</p>',
       );
diff --git a/uc_stock/src/Controller/StockReports.php b/uc_stock/src/Controller/StockReports.php
index bf23542..64df30a 100644
--- a/uc_stock/src/Controller/StockReports.php
+++ b/uc_stock/src/Controller/StockReports.php
@@ -8,7 +8,7 @@
 namespace Drupal\uc_stock\Controller;
 
 use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Url;
+use Drupal\Core\Link;
 use Drupal\uc_report\Controller\Reports;
 
 /**
@@ -63,14 +63,14 @@ class StockReports extends ControllerBase {
     foreach ($result as $stock) {
       $op = array();
       if ($this->currentUser()->hasPermission('administer product stock')) {
-        $op[] = $this->l($this->t('edit'), Url::fromRoute('uc_stock.edit', ['node' => $stock->nid], ['query' => ['destination' => 'admin/store/reports/stock']]));
+        $op[] = Link::createFromRoute($this->t('edit'), 'uc_stock.edit', ['node' => $stock->nid], ['query' => ['destination' => 'admin/store/reports/stock']])->toString();
       }
 
       // Add the data to a table row for display.
       $rows[] = array(
         'data' => array(
           array('data' => $stock->sku),
-          array('data' => $this->l($stock->title, Url::fromRoute('uc_stock.edit', ['node' => $stock->nid]))),
+          array('data' => Link::createFromRoute($stock->title, 'uc_stock.edit', ['node' => $stock->nid])->toString()),
           array('data' => $stock->stock),
           array('data' => $stock->threshold),
           array('data' => implode(' ', $op)),
@@ -102,18 +102,18 @@ class StockReports extends ControllerBase {
       '#suffix' => '</div>',
     );
     $build['links']['export_csv'] = array(
-      '#markup' => $this->l($this->t('Export to CSV file'), Url::fromRoute('uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])),
+      '#markup' => Link::createFromRoute($this->t('Export to CSV file'), 'uc_report.getcsv', ['report_id' => $csv_data['report'], 'user_id' => $csv_data['user']])->toString(),
       '#suffix' => '&nbsp;&nbsp;&nbsp;',
     );
 
 //    if (isset($_GET['nopage'])) {
 //      $build['links']['toggle_pager'] = array(
-//        '#markup' => $this->l($this->t('Show paged records'), Url::fromRoute('base:admin/store/reports/stock')),
+//        '#markup' => Link::createFromRoute($this->t('Show paged records'), 'uc_stock.reports')->toString(),
 //      );
 //    }
 //    else {
       $build['links']['toggle_pager'] = array(
-        '#markup' => $this->l($this->t('Show all records'), Url::fromRoute('uc_stock.reports'), [], ['query' => ['nopage' => '1']]),
+        '#markup' => Link::createFromRoute($this->t('Show all records'), 'uc_stock.reports', [], ['query' => ['nopage' => '1']])->toString(),
       );
 //    }
 
diff --git a/uc_store/src/Form/StoreSettingsForm.php b/uc_store/src/Form/StoreSettingsForm.php
index f4ee28e..8786dd5 100644
--- a/uc_store/src/Form/StoreSettingsForm.php
+++ b/uc_store/src/Form/StoreSettingsForm.php
@@ -79,7 +79,7 @@ class StoreSettingsForm extends ConfigFormBase {
       '#description' => $this->t('The Drupal page for the store help link.'),
       '#default_value' => $config->get('help_page'),
       '#size' => 32,
-      '#field_prefix' => $this->url('<front>', [], ['absolute' => TRUE]),
+      '#field_prefix' => Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString(),
     );
 
     $form['address'] = array(
diff --git a/uc_tax/src/Form/TaxRateFormBase.php b/uc_tax/src/Form/TaxRateFormBase.php
index 476e8b4..774ae63 100644
--- a/uc_tax/src/Form/TaxRateFormBase.php
+++ b/uc_tax/src/Form/TaxRateFormBase.php
@@ -9,7 +9,7 @@ namespace Drupal\uc_tax\Form;
 
 use Drupal\Core\Entity\EntityForm;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Url;
+use Drupal\Core\Link;
 
 /**
  * Defines the tax rate add/edit form.
@@ -177,16 +177,16 @@ class TaxRateFormBase extends EntityForm {
     $status = $tax_rate->save();
 
     // Create an edit link.
-    $edit_link = $this->l($this->t('Edit'), $tax_rate->urlInfo());
+    $edit_link = Link::fromTextAndUrl($this->t('Edit'), $tax_rate->urlInfo())->toString();
 
     if ($status == SAVED_UPDATED) {
       // If we edited an existing entity...
-      drupal_set_message($this->t('Tax rate %label has been updated.', array('%label' => $tax_rate->label())));
+      drupal_set_message($this->t('Tax rate %label has been updated.', ['%label' => $tax_rate->label()]));
       $this->logger('contact')->notice('Tax rate %label has been updated.', ['%label' => $tax_rate->label(), 'link' => $edit_link]);
     }
     else {
       // If we created a new entity...
-      drupal_set_message($this->t('Tax rate %label has been added.', array('%label' => $tax_rate->label())));
+      drupal_set_message($this->t('Tax rate %label has been added.', ['%label' => $tax_rate->label()]));
       $this->logger('contact')->notice('Tax rate %label has been added.', ['%label' => $tax_rate->label(), 'link' => $edit_link]);
     }
 
@@ -202,7 +202,7 @@ class TaxRateFormBase extends EntityForm {
 
     // Change the submit button text.
     $actions['submit']['#value'] = $this->t('Save');
-    $actions['submit']['#suffix'] = $this->l($this->t('Cancel'), $this->getCancelUrl());
+    $actions['submit']['#suffix'] = Link::fromTextAndUrl($this->t('Cancel'), $this->getCancelUrl())->toString();
 
     return $actions;
   }
