You are here

function saml_sp_get_tempstore in SAML Service Provider 4.x

Same name and namespace in other branches
  1. 8.3 saml_sp.module \saml_sp_get_tempstore()
  2. 8.2 saml_sp.module \saml_sp_get_tempstore()
  3. 3.x saml_sp.module \saml_sp_get_tempstore()

Get the appropriate tempstore for the version of Drupal we are using.

3 calls to saml_sp_get_tempstore()
SamlSPController::consume in src/Controller/SamlSPController.php
Receive data back from the IdP.
saml_sp__get_tracked_request in ./saml_sp.module
Get the IdP and callback from a tracked request.
saml_sp__track_request in ./saml_sp.module
Track an outbound request.

File

./saml_sp.module, line 310
SAML Service Provider.

Code

function saml_sp_get_tempstore($name) {

  // Determine is the Drupal version is one that has 'tempstore.shared' and
  // use it, otherwise use 'user.shared_tempstore'.
  switch (version_compare(Drupal::VERSION, '8.5.0')) {
    case -1:

      // When Drupal::Version is less than 8.5.0:
      $service = 'user.shared_tempstore';
      break;
    default:

      // When Drupal::VERSION is greater than or equal to 8.5.0:
      $service = 'tempstore.shared';
  }
  $factory = \Drupal::service($service);
  $store = $factory
    ->get('saml_sp.' . $name);
  return $store;
}