Comments

rocket.man created an issue. See original summary.

bkhandruk’s picture

Assigned: bkhandruk » Unassigned
Status: Active » Needs review
StatusFileSize
new7.39 KB

Replaced all deprecated uses in module.

snufkin’s picture

Status: Needs review » Fixed

Awesome, thanks for taking the time for this!

SimonPhillips’s picture

I'm seeing the following error on the user/login page with this code change:

The website encountered an unexpected error. Please try again later.
Recoverable fatal error: Object of class Drupal\Core\Link could not be converted to string in Drupal\Component\Utility\Xss::filter() (line 67 of core/lib/Drupal/Component/Utility/Xss.php).

This appears to be due to this change:

+use Drupal\Core\Link;
 
 /**
  * Implements hook_help().
@@ -151,13 +152,12 @@ function simplesamlphp_auth_form_user_login_form_alter(&$form, FormStateInterfac
   }
 
   $label = Drupal::config('simplesamlphp_auth.settings')->get('login_link_display_name');
-
   $form['simplesamlphp_auth_login_link'] = array(
-    '#markup' => \Drupal::l($label, new Url('simplesamlphp_auth.saml_login', array(), array(
+    '#markup' => Link::createFromRoute($label, 'simplesamlphp_auth.saml_login', array(), array(
       'attributes' => array(
         'class' => array('simplesamlphp-auth-login-link'),
       ),
-    ))),
+    )),
   );
 
 }

I'm not sure if this is because we've got something wrong in our theming setup or if this is a genuine bug.

snufkin’s picture

This looks like a genuine bug and a regression, not the result of your theming setup. The API usage in this snippet is wrong. I've opened a separate issue for this: #2861948: Incorrect usage of #markup and the Link object, will roll a patch soon.

snufkin’s picture

@SimonPhillips could you check the issue mentioned in #6 please? Does it fix your theme issues, does it result in code you can theme properly?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.