public static function SmartIp::getSession in Smart IP 8.2
Same name and namespace in other branches
- 8.4 src/SmartIp.php \Drupal\smart_ip\SmartIp::getSession()
- 8.3 src/SmartIp.php \Drupal\smart_ip\SmartIp::getSession()
Read session variable.
Parameters
string $key: The session variable to read. Pass 'smart_ip' to read the smart_ip data.
Return value
array Session value.
2 calls to SmartIp::getSession()
- SmartIp::updateUserLocation in src/
SmartIp.php - Update user's location only if the IP address stored in session is not the same as the IP address detected by the server.
- SmartIpLocation::getData in src/
SmartIpLocation.php - Gets all the Smart IP location data.
File
- src/
SmartIp.php, line 93 - Contains \Drupal\smart_ip\SmartIp.
Class
- SmartIp
- Smart IP static basic methods wrapper.
Namespace
Drupal\smart_ipCode
public static function getSession($key, $update = TRUE) {
if (\Drupal::moduleHandler()
->moduleExists('session_cache')) {
$smartIpSession = session_cache_get($key);
}
else {
/** @var \Symfony\Component\HttpFoundation\Session\Session $session */
$session = \Drupal::service('session');
$smartIpSession = $session
->get($key);
}
return $smartIpSession;
}