/**
* Get a variable stored in the Fluid template
* @param string $viewHelperClassName Class name of the ViewHelper which stored the variable
* @param string $name Name of the variable which the ViewHelper stored
* @param string $sectionName Optional name of a section in which the ViewHelper was called
* @return mixed
* @throws \RuntimeException
*/
protected function getStoredVariable($viewHelperClassName, $name, $sectionName = NULL)
{
if (FALSE === $this->controllerContext instanceof ControllerContext) {
throw new \RuntimeException('ExposedTemplateView->getStoredVariable requires a ControllerContext, none exists (getStoredVariable method)', 1343521593);
}
$this->baseRenderingContext->setControllerContext($this->controllerContext);
$this->templateParser->setConfiguration($this->buildParserConfiguration());
$parsedTemplate = $this->getParsedTemplate();
$this->startRendering(AbstractTemplateView::RENDERING_TEMPLATE, $parsedTemplate, $this->baseRenderingContext);
if (FALSE === empty($sectionName)) {
$this->renderSection($sectionName, $this->baseRenderingContext->getTemplateVariableContainer()->getAll());
} else {
$this->render();
}
$this->stopRendering();
if (FALSE === $this->baseRenderingContext->getViewHelperVariableContainer()->exists($viewHelperClassName, $name)) {
return NULL;
}
$stored = $this->baseRenderingContext->getViewHelperVariableContainer()->get($viewHelperClassName, $name);
$templateIdentityForLog = NULL !== $this->templateSource ? 'source code with hash value ' . sha1($this->templateSource) : $this->getTemplatePathAndFilename();
$this->configurationService->message('Flux View ' . get_class($this) . ' is able to read stored configuration from ' . $templateIdentityForLog, GeneralUtility::SYSLOG_SEVERITY_INFO);
return $stored;
}