From 7ee299794ee2cbc297a13b2b743ab094d5710201 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Wed, 12 Oct 2016 14:46:03 +0100 Subject: [PATCH] Issue #2809333 by andypost: Use build array for user login block links --- .../user/src/Plugin/Block/UserLoginBlock.php | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/core/modules/user/src/Plugin/Block/UserLoginBlock.php b/core/modules/user/src/Plugin/Block/UserLoginBlock.php index 34957c9098..d7ff9da73c 100644 --- a/core/modules/user/src/Plugin/Block/UserLoginBlock.php +++ b/core/modules/user/src/Plugin/Block/UserLoginBlock.php @@ -98,19 +98,27 @@ public function build() { // Build action links. $items = array(); if (\Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) { - $items['create_account'] = \Drupal::l($this->t('Create new account'), new Url('user.register', array(), array( - 'attributes' => array( - 'title' => $this->t('Create a new user account.'), - 'class' => array('create-account-link'), - ), - ))); + $items['create_account'] = [ + '#type' => 'link', + '#title' => $this->t('Create new account'), + '#url' => Url::fromRoute('user.register', [], [ + 'attributes' => [ + 'title' => $this->t('Create a new user account.'), + 'class' => ['create-account-link'], + ], + ]), + ]; } - $items['request_password'] = \Drupal::l($this->t('Reset your password'), new Url('user.pass', array(), array( - 'attributes' => array( - 'title' => $this->t('Send password reset instructions via email.'), - 'class' => array('request-password-link'), - ), - ))); + $items['request_password'] = [ + '#type' => 'link', + '#title' => $this->t('Reset your password'), + '#url' => Url::fromRoute('user.pass', [], [ + 'attributes' => [ + 'title' => $this->t('Send password reset instructions via email.'), + 'class' => ['request-password-link'], + ], + ]), + ]; return array( 'user_login_form' => $form, 'user_links' => array( -- GitLab