function AccountSwitcherInterface::switchTo
Same name in other branches
- 9 core/lib/Drupal/Core/Session/AccountSwitcherInterface.php \Drupal\Core\Session\AccountSwitcherInterface::switchTo()
- 8.9.x core/lib/Drupal/Core/Session/AccountSwitcherInterface.php \Drupal\Core\Session\AccountSwitcherInterface::switchTo()
- 11.x core/lib/Drupal/Core/Session/AccountSwitcherInterface.php \Drupal\Core\Session\AccountSwitcherInterface::switchTo()
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 $account: The account to switch to.
Return value
$this $this.
File
-
core/
lib/ Drupal/ Core/ Session/ AccountSwitcherInterface.php, line 25
Class
- AccountSwitcherInterface
- Defines an interface for a service for safe account switching.
Namespace
Drupal\Core\SessionCode
public function switchTo(AccountInterface $account);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.