You are here

public function AutologoutManager::getRoleUrl in Automated Logout 8

Iterate roles to get the per-role logout URL, default is the global URL.

Return value

array List of roles with logout URL.

Overrides AutologoutManagerInterface::getRoleUrl

1 call to AutologoutManager::getRoleUrl()
AutologoutManager::getUserRedirectUrl in src/AutologoutManager.php
Get a user's logout URL.

File

src/AutologoutManager.php, line 229

Class

AutologoutManager
Defines an AutologoutManager service.

Namespace

Drupal\autologout

Code

public function getRoleUrl() {
  $roles = user_roles(TRUE);
  $role_url = [];

  // Go through roles, get timeouts for each and return as array.
  foreach ($roles as $name => $role) {
    $role_settings = $this->configFactory
      ->get('autologout.role.' . $name);
    if ($role_settings
      ->get('enabled')) {
      $url_role = $role_settings
        ->get('url');
      $role_url[$name] = $url_role;
    }
  }
  return $role_url;
}