public function renderLocationEmbed($locationId, $viewType, array $parameters, $isInline)
{
$isDenied = false;
try {
$location = $this->checkLocation($locationId);
if ($location->invisible) {
if (isset($this->logger)) {
$this->logger->error("Could not render embedded resource: Location #{$locationId} is not visible");
}
return null;
}
} catch (AccessDeniedException $e) {
if (isset($this->logger)) {
$this->logger->error("Could not render embedded resource: access denied to embed Location #{$locationId}");
}
$isDenied = true;
} catch (Exception $e) {
if ($e instanceof NotFoundHttpException || $e instanceof NotFoundException) {
if (isset($this->logger)) {
$this->logger->error("Could not render embedded resource: Location #{$locationId} not found");
}
return null;
} else {
throw $e;
}
}
$templateName = $this->getEmbedTemplateName(static::RESOURCE_TYPE_LOCATION, $isInline, $isDenied);
if ($templateName === null) {
$this->logger->error('Could not render embedded resource: no template configured');
return null;
}
if (!$this->templateEngine->exists($templateName)) {
if (isset($this->logger)) {
$this->logger->error("Could not render embedded resource: template '{$templateName}' does not exists");
}
return null;
}
return $this->render($templateName, $parameters);
}