コード例 #1
0
ファイル: FluxService.php プロジェクト: fluidtypo3/flux
 /**
  * @param ViewContext $viewContext
  * @return ExposedTemplateView
  */
 public function getPreparedExposedTemplateView(ViewContext $viewContext)
 {
     $vendorName = $viewContext->getVendorName();
     $extensionKey = $viewContext->getExtensionKey();
     $qualifiedExtensionName = $viewContext->getExtensionName();
     $controllerName = $viewContext->getControllerName();
     $variables = $viewContext->getVariables();
     if (NULL === $qualifiedExtensionName || FALSE === ExtensionManagementUtility::isLoaded($extensionKey)) {
         // Note here: a default value of the argument would not be adequate; outside callers could still pass NULL.
         $qualifiedExtensionName = 'Flux';
     }
     $extensionName = ExtensionNamingUtility::getExtensionName($qualifiedExtensionName);
     /** @var $context ControllerContext */
     $context = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext');
     $request = $viewContext->getRequest();
     /** @var $response Response */
     $response = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response');
     /** @var $uriBuilder UriBuilder */
     $uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
     $uriBuilder->setRequest($request);
     $context->setUriBuilder($uriBuilder);
     $context->setRequest($request);
     $context->setResponse($response);
     /** @var $renderingContext RenderingContext */
     $renderingContext = $this->objectManager->get(FluxPackageFactory::getPackageWithFallback($qualifiedExtensionName)->getImplementation(FluxPackage::IMPLEMENTATION_RENDERINGCONTEXT));
     $renderingContext->setControllerContext($context);
     /** @var $exposedView ExposedTemplateView */
     $exposedView = $this->objectManager->get(FluxPackageFactory::getPackageWithFallback($qualifiedExtensionName)->getImplementation(FluxPackage::IMPLEMENTATION_VIEW));
     $exposedView->setRenderingContext($renderingContext);
     $exposedView->setControllerContext($context);
     $exposedView->assignMultiple($variables);
     $exposedView->setTemplatePaths($viewContext->getTemplatePaths());
     $exposedView->setTemplatePathAndFilename($viewContext->getTemplatePathAndFilename());
     return $exposedView;
 }