/**
* @param string|NULL
*/
public function renderIn($backlink)
{
$httpRequest = $this->getHttpRequest();
$referer = NULL;
if ($httpRequest instanceof \Nette\Http\Request) {
$referer = $httpRequest->getReferer();
}
if (!$backlink && $referer && $referer->getHost() == $httpRequest->getUrl()->getHost()) {
$url = new UrlScript($referer);
$url->setScriptPath($httpRequest->getUrl()->getScriptPath());
$tmp = new Request($url);
$req = $this->router->match($tmp);
if (!$req) {
return;
}
if (isset($req->parameters[static::SIGNAL_KEY])) {
$params = $req->parameters;
unset($params[static::SIGNAL_KEY]);
$req->setParameters($params);
}
if ($req->getPresenterName() != $this->getName()) {
$session = $this->getSession('Nette.Application/requests');
do {
$key = Strings::random(5);
} while (isset($session[$key]));
$session[$key] = array($this->getUser()->getId(), $req);
$session->setExpiration('+ 10 minutes', $key);
$this->params['backlink'] = $key;
}
}
}