You are here

protected function FeedsExecutable::switchAccount in Feeds 8.3

Safely switches to another account.

Parameters

\Drupal\feeds\FeedInterface $feed: The feed that has the account to switch to.

Return value

\Drupal\Core\Session\AccountSwitcherInterface The account switcher to call switchBack() on.

See also

\Drupal\Core\Session\AccountSwitcherInterface::switchTo()

1 call to FeedsExecutable::switchAccount()
FeedsExecutable::processItem in src/FeedsExecutable.php
Processes a stage of an import.

File

src/FeedsExecutable.php, line 159

Class

FeedsExecutable
Defines a feeds executable class.

Namespace

Drupal\feeds

Code

protected function switchAccount(FeedInterface $feed) {
  $account = new AccountProxy($this
    ->getEventDispatcher());
  $account
    ->setInitialAccountId($feed
    ->getOwnerId());
  return $this->accountSwitcher
    ->switchTo($account);
}