本文整理汇总了PHP中TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface::setControllerContext方法的典型用法代码示例。如果您正苦于以下问题:PHP RenderingContextInterface::setControllerContext方法的具体用法?PHP RenderingContextInterface::setControllerContext怎么用?PHP RenderingContextInterface::setControllerContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface
的用法示例。
在下文中一共展示了RenderingContextInterface::setControllerContext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controllerContextCanBeReadCorrectly
/**
* @test
*/
public function controllerContextCanBeReadCorrectly()
{
$controllerContext = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext::class, array('getRequest'), array(), '', false);
$controllerContext->expects($this->atLeastOnce())->method('getRequest')->willReturn($this->getMock(Request::class));
$this->renderingContext->setControllerContext($controllerContext);
$this->assertSame($this->renderingContext->getControllerContext(), $controllerContext);
}
示例2: render
/**
* Loads the template source and render the template.
* If "layoutName" is set in a PostParseFacet callback, it will render the file with the given layout.
*
* @param string $actionName If set, the view of the specified action will be rendered instead. Default is the action specified in the Request object
* @return string Rendered Template
* @api
*/
public function render($actionName = NULL)
{
$this->baseRenderingContext->setControllerContext($this->controllerContext);
$this->templateParser->setConfiguration($this->buildParserConfiguration());
$templateIdentifier = $this->getTemplateIdentifier($actionName);
if ($this->templateCompiler->has($templateIdentifier)) {
$parsedTemplate = $this->templateCompiler->get($templateIdentifier);
} else {
$parsedTemplate = $this->templateParser->parse($this->getTemplateSource($actionName));
if ($parsedTemplate->isCompilable()) {
$this->templateCompiler->store($templateIdentifier, $parsedTemplate);
}
}
if ($parsedTemplate->hasLayout()) {
$layoutName = $parsedTemplate->getLayoutName($this->baseRenderingContext);
$layoutIdentifier = $this->getLayoutIdentifier($layoutName);
if ($this->templateCompiler->has($layoutIdentifier)) {
$parsedLayout = $this->templateCompiler->get($layoutIdentifier);
} else {
$parsedLayout = $this->templateParser->parse($this->getLayoutSource($layoutName));
if ($parsedLayout->isCompilable()) {
$this->templateCompiler->store($layoutIdentifier, $parsedLayout);
}
}
$this->startRendering(self::RENDERING_LAYOUT, $parsedTemplate, $this->baseRenderingContext);
$output = $parsedLayout->render($this->baseRenderingContext);
$this->stopRendering();
} else {
$this->startRendering(self::RENDERING_TEMPLATE, $parsedTemplate, $this->baseRenderingContext);
$output = $parsedTemplate->render($this->baseRenderingContext);
$this->stopRendering();
}
return $output;
}
示例3: prepareContextsForUncachedRendering
/**
* @param \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext
* @param \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext
* @return void
*/
protected function prepareContextsForUncachedRendering(RenderingContextInterface $renderingContext, ControllerContext $controllerContext)
{
$renderingContext->setControllerContext($controllerContext);
$this->setRenderingContext($renderingContext);
$this->templateParser = TemplateParserBuilder::build();
$this->templateCompiler = $this->objectManager->get('TYPO3\\CMS\\Fluid\\Core\\Compiler\\TemplateCompiler');
$this->templateCompiler->setTemplateCache($GLOBALS['typo3CacheManager']->getCache('fluid_template'));
}
示例4: controllerContextCanBeReadCorrectly
/**
* @test
*/
public function controllerContextCanBeReadCorrectly()
{
$controllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE);
$this->renderingContext->setControllerContext($controllerContext);
$this->assertSame($this->renderingContext->getControllerContext(), $controllerContext);
}
示例5: controllerContextCanBeReadCorrectly
/**
* @test
*/
public function controllerContextCanBeReadCorrectly()
{
$controllerContext = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext::class, array(), array(), '', false);
$this->renderingContext->setControllerContext($controllerContext);
$this->assertSame($this->renderingContext->getControllerContext(), $controllerContext);
}