public function ContextUploader::getContextualizedPage in TMGMT Translator Smartling 8.3
Same name and namespace in other branches
- 8.4 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::getContextualizedPage()
- 8 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::getContextualizedPage()
- 8.2 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 70
Class
Namespace
Drupal\tmgmt_smartling\ContextCode
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);
if (empty($html)) {
throw new Exception("Got empty context for {$url} url.");
}
return $html;
}