You are here

protected function SimplenewsSourceEntity::resetContext in Simplenews 7.2

Reset the context.

2 calls to SimplenewsSourceEntity::resetContext()
SimplenewsSourceEntity::getBodyWithFormat in includes/simplenews.source.inc
Get the body with the requested format.
SimplenewsSourceEntity::getFooterWithFormat in includes/simplenews.source.inc
Get the footer in the specified format.

File

includes/simplenews.source.inc, line 610
Contains SimplenewsSource interface and implementations.

Class

SimplenewsSourceEntity
Default source class for entities.

Code

protected function resetContext() {

  // Switch back to the previous user.
  if ($this->uid) {
    simplenews_revert_user();
  }

  // Switch language back.
  if (!empty($this->original_language)) {
    $GLOBALS['language'] = $this->original_language;
    $GLOBALS['language_url'] = $this->original_language;
    if (module_exists('i18n_select')) {
      $GLOBALS['language_content'] = $this->original_language;
    }
  }
}