You are here

public function ContextUploader::getContextualizedPage in TMGMT Translator Smartling 8.2

Same name and namespace in other branches
  1. 8.4 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::getContextualizedPage()
  2. 8 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::getContextualizedPage()
  3. 8.3 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::getContextualizedPage()

Parameters

$url:

array $settings:

bool $debug:

Return value

mixed|string|void

Throws

\Drupal\tmgmt_smartling\Exceptions\EmptyContextParameterException

Exception

1 call to ContextUploader::getContextualizedPage()
ContextUploader::upload in src/Context/ContextUploader.php

File

src/Context/ContextUploader.php, line 58

Class

ContextUploader

Namespace

Drupal\tmgmt_smartling\Context

Code

public function getContextualizedPage($url, array $settings, $debug = FALSE) {
  if (empty($url)) {
    throw new EmptyContextParameterException('Context url must be a non-empty string.');
  }
  $username = $settings['contextUsername'];
  if (empty($username)) {
    $username = $this->authenticator
      ->getCurrentAccount()
      ->getAccountName();
  }
  $cookies = $this->authenticator
    ->getCookies($username, $settings['context_silent_user_switching']);
  $html = $this->assetInliner
    ->getCompletePage($url, $cookies, TRUE, FALSE, $settings, $debug);
  $html = str_replace('<p></p>', "\n", $html);
  return $html;
}