class AccountSwitcherDecorator in Acquia Content Hub 8
Extend current account switcher service functionality.
@package Drupal\acquia_contenthub
Hierarchy
- class \Drupal\Core\Session\AccountSwitcher implements AccountSwitcherInterface
- class \Drupal\acquia_contenthub\AccountSwitcherDecorator
Expanded class hierarchy of AccountSwitcherDecorator
1 string reference to 'AccountSwitcherDecorator'
1 service uses AccountSwitcherDecorator
File
- src/
AccountSwitcherDecorator.php, line 12
Namespace
Drupal\acquia_contenthubView source
class AccountSwitcherDecorator extends AccountSwitcher {
/**
* Switch back only if account stack contains at least one account.
*/
public function switchBack() {
// If there are no more accounts in the account stack,
// current user will be the original user.
if (count($this->accountStack) !== 0) {
parent::switchBack();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AccountSwitcher:: |
protected | property | A stack of previous overridden accounts. | |
AccountSwitcher:: |
protected | property | The current user service. | |
AccountSwitcher:: |
protected | property | The original state of session saving prior to account switching. | |
AccountSwitcher:: |
protected | property | The write-safe session handler. | |
AccountSwitcher:: |
public | function |
Safely switches to another account. Overrides AccountSwitcherInterface:: |
|
AccountSwitcher:: |
public | function | Constructs a new AccountSwitcher. | |
AccountSwitcherDecorator:: |
public | function |
Switch back only if account stack contains at least one account. Overrides AccountSwitcher:: |