FluidTYPO3\Flux\View\ExposedTemplateView::getStoredVariable PHP Method

getStoredVariable() protected method

Get a variable stored in the Fluid template
protected getStoredVariable ( string $viewHelperClassName, string $name, string $sectionName = NULL ) : mixed
$viewHelperClassName string Class name of the ViewHelper which stored the variable
$name string Name of the variable which the ViewHelper stored
$sectionName string Optional name of a section in which the ViewHelper was called
return mixed
    protected function getStoredVariable($viewHelperClassName, $name, $sectionName = NULL)
    {
        if (TRUE === isset($this->renderedSections[$sectionName])) {
            return $this->renderedSections[$sectionName]->get($viewHelperClassName, $name);
        }
        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->setRenderingContext($this->baseRenderingContext);
        if (isset($this->templateParser)) {
            // Note: this is for compatibility with Standalone Fluid as base;
            // this package no longer requires this initialisation when rendering sections.
            $this->templateParser->setConfiguration($this->buildParserConfiguration());
        }
        $parsedTemplate = $this->getParsedTemplate();
        $this->startRendering(AbstractTemplateView::RENDERING_TEMPLATE, $parsedTemplate, $this->baseRenderingContext);
        $viewHelperVariableContainer = $this->baseRenderingContext->getViewHelperVariableContainer();
        if (FALSE === empty($sectionName)) {
            $this->renderStandaloneSection($sectionName, $this->baseRenderingContext->getTemplateVariableContainer()->getAll());
        } else {
            $this->render();
        }
        $this->stopRendering();
        if (FALSE === $viewHelperVariableContainer->exists($viewHelperClassName, $name)) {
            return NULL;
        }
        $this->renderedSections[$sectionName] = $viewHelperVariableContainer;
        $stored = $viewHelperVariableContainer->get($viewHelperClassName, $name);
        return $stored;
    }