🇦🇺Australia @brettsh

Account created on 24 December 2011, almost 13 years ago
#

Recent comments

🇦🇺Australia brettsh

Eventually, I discovered there was a 'change' cmd I could use. So all I needed to dynamically update the field was:

function my_module_address_ajax_callback(array &$form, FormStateInterface $form_state) {
    $response = new AjaxResponse();
    // Set the individual sub-fields
    $form['my_address']['postal_code']['#value'] = $postal_code;
    ...
    // Trigger a change event on the address field to reformat it.
    $response->addCommand(new InvokeCommand('[id^="edit-my-address"]', 'change'));
    return $response;
🇦🇺Australia brettsh

Well... it's not pretty, but I ended up placing the IdP clas in the session.

I created a class MyModuleSamlSPDrupalLoginController that extended SamlSPDrupalLoginController

Stored $idp in the session:

public function initiate(Idp $idp) {
  $_SESSION['my_module_idp'] = $idp;
  ...

And altered the login route:

protected function alterRoutes(RouteCollection $collection) {
  if($route = $collection->get('saml_sp_drupal_login.login')) {
    $route->setDefault('_controller', '\Drupal\stv_saml\Controller\StvSamlSPDrupalLoginController::initiate');
  }
}
Production build 0.71.5 2024