public function getFluidRendererForTemplate(string $template, string $format = 'html') {
    $configurationManager = $this->objectManager->get(ConfigurationManagerInterface::class);
    $configuration        = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
    $layoutRootPath       = $configuration['view']['layoutRootPath'];

    if (empty($layoutRootPath)) {
      $firstLayoutRootPath = reset($configuration['view']['layoutRootPaths']);

      $layoutRootPath = GeneralUtility::getFileAbsFileName($firstLayoutRootPath);
    } else {
      $layoutRootPath = GeneralUtility::getFileAbsFileName($layoutRootPath);
    }

    $templateRootPath = $configuration['view']['templateRootPath'];

    if (empty($templateRootPath)) {
      $firstTemplateRootPath = reset($configuration['view']['templateRootPaths']);

      $templateRootPath = GeneralUtility::getFileAbsFileName($firstTemplateRootPath);
    } else {
      $templateRootPath = GeneralUtility::getFileAbsFileName($templateRootPath);
    }

    $partialRootPath = $configuration['view']['partialRootPath'];

    if (empty($partialRootPath)) {
      $firstPartialRootPath = reset($configuration['view']['partialRootPaths']);

      $partialRootPath = GeneralUtility::getFileAbsFileName($firstPartialRootPath);
    } else {
      $partialRootPath = GeneralUtility::getFileAbsFileName($partialRootPath);
    }

    $renderer = $this->objectManager->get(StandaloneView::class);
    $renderer->setLayoutRootPaths([$layoutRootPath]);
    $renderer->setPartialRootPaths([$partialRootPath]);
    $renderer->setTemplatePathAndFilename($templateRootPath . $template);
    $renderer->setFormat($format);

    return $renderer;
  }
public function getFluidRendererForTemplate(string $template, string $format = 'html') {
    $configurationManager = $this->objectManager->get(ConfigurationManagerInterface::class);
    $configuration        = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
    $layoutRootPath       = $configuration['view']['layoutRootPath'];

    if (empty($layoutRootPath)) {
      $firstLayoutRootPath = reset($configuration['view']['layoutRootPaths']);

      $layoutRootPath = GeneralUtility::getFileAbsFileName($firstLayoutRootPath);
    } else {
      $layoutRootPath = GeneralUtility::getFileAbsFileName($layoutRootPath);
    }

    $templateRootPath = $configuration['view']['templateRootPath'];

    if (empty($templateRootPath)) {
      $firstTemplateRootPath = reset($configuration['view']['templateRootPaths']);

      $templateRootPath = GeneralUtility::getFileAbsFileName($firstTemplateRootPath);
    } else {
      $templateRootPath = GeneralUtility::getFileAbsFileName($templateRootPath);
    }

    $partialRootPath = $configuration['view']['partialRootPath'];

    if (empty($partialRootPath)) {
      $firstPartialRootPath = reset($configuration['view']['partialRootPaths']);

      $partialRootPath = GeneralUtility::getFileAbsFileName($firstPartialRootPath);
    } else {
      $partialRootPath = GeneralUtility::getFileAbsFileName($partialRootPath);
    }

    $renderer = $this->objectManager->get(StandaloneView::class);
    $renderer->setLayoutRootPaths([$layoutRootPath]);
    $renderer->setPartialRootPaths([$partialRootPath]);
    $renderer->setTemplatePathAndFilename($templateRootPath . $template);
    $renderer->setFormat($format);

    return $renderer;
  }
public function getFluidRendererForTemplate ( string $ template , string $ format = 'html' ) { $ configurationManager = $ this -> objectManager -> get ( ConfigurationManagerInterface :: class ) ; $ configuration = $ configurationManager -> getConfiguration ( ConfigurationManagerInterface :: CONFIGURATION_TYPE_FRAMEWORK ) ; $ layoutRootPath = $ configuration [ 'view' ] [ 'layoutRootPath' ] ; if ( empty ( $ layoutRootPath ) ) { $ firstLayoutRootPath = reset ( $ configuration [ 'view' ] [ 'layoutRootPaths' ] ) ; $ layoutRootPath = GeneralUtility :: getFileAbsFileName ( $ firstLayoutRootPath ) ; } else { $ layoutRootPath = GeneralUtility :: getFileAbsFileName ( $ layoutRootPath ) ; } $ templateRootPath = $ configuration [ 'view' ] [ 'templateRootPath' ] ; if ( empty ( $ templateRootPath ) ) { $ firstTemplateRootPath = reset ( $ configuration [ 'view' ] [ 'templateRootPaths' ] ) ; $ templateRootPath = GeneralUtility :: getFileAbsFileName ( $ firstTemplateRootPath ) ; } else { $ templateRootPath = GeneralUtility :: getFileAbsFileName ( $ templateRootPath ) ; } $ partialRootPath = $ configuration [ 'view' ] [ 'partialRootPath' ] ; if ( empty ( $ partialRootPath ) ) { $ firstPartialRootPath = reset ( $ configuration [ 'view' ] [ 'partialRootPaths' ] ) ; $ partialRootPath = GeneralUtility :: getFileAbsFileName ( $ firstPartialRootPath ) ; } else { $ partialRootPath = GeneralUtility :: getFileAbsFileName ( $ partialRootPath ) ; } $ renderer = $ this -> objectManager -> get ( StandaloneView :: class ) ; $ renderer -> setLayoutRootPaths ( [ $ layoutRootPath ] ) ; $ renderer -> setPartialRootPaths ( [ $ partialRootPath ] ) ; $ renderer -> setTemplatePathAndFilename ( $ templateRootPath . $ template ) ; $ renderer -> setFormat ( $ format ) ; return $ renderer ; }
Gets a Fluid renderer for a template.

@param string $template The template
@param string $format The optional format, `html` is used as default
@return \TYPO3\CMS\Fluid\View\StandaloneView The renderer for the template
Gets a Fluid renderer for a template .