You are here

protected function LinkStatusHandlerBase::switchSession in Link checker 8

Helper function to switch session.

1 call to LinkStatusHandlerBase::switchSession()
LinkStatusHandlerBase::handle in src/Plugin/LinkStatusHandlerBase.php
Handles a status code of link.

File

src/Plugin/LinkStatusHandlerBase.php, line 176

Class

LinkStatusHandlerBase
Base class for Link status handler plugins.

Namespace

Drupal\linkchecker\Plugin

Code

protected function switchSession() {

  // Switch anonymous user to an admin.
  $this->accountSwitcher
    ->switchTo(new UserSession([
    'uid' => user_load_by_name($this->linkcheckerSetting
      ->get('error.impersonate_account')),
  ]));
}