Drupal 8  8.0.2
AccountSwitcherInterface Interface Reference
Inheritance diagram for AccountSwitcherInterface:

Public Member Functions

 switchTo (AccountInterface $account)
 
 switchBack ()
 

Detailed Description

Defines an interface for a service for safe account switching.

Member Function Documentation

switchBack ( )

Reverts to a previous account after switching.

Returns
$this.
Exceptions
\RuntimeExceptionWhen there are no more account switches to revert.

Implemented in AccountSwitcher.

switchTo ( AccountInterface  $account)

Safely switches to another account.

Each invocation of AccountSwitcherInterface::switchTo() must be matched by a corresponding invocation of AccountSwitcherInterface::switchBack() in the same function.

Parameters
\Drupal\Core\Session\AccountInterface$accountThe account to switch to.
Returns
$this.

Implemented in AccountSwitcher.


The documentation for this interface was generated from the following file: