Created
February 25, 2014 08:34
-
-
Save kj187/9205103 to your computer and use it in GitHub Desktop.
StandaloneView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Step 1: | |
$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); | |
$this->configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager'); | |
#Step 2: | |
Call $this->getStandaloneView(array('job' => $job), 'Pdf/Email.html')->render(); | |
/** | |
* @param array $store | |
* @return string | |
*/ | |
protected function getStandaloneView(array $variables, $template) { | |
$viewObject = $this->objectManager->create('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); | |
$viewObject->setFormat('html'); | |
$extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); | |
$templateRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['templateRootPath']); | |
$templatePathAndFilename = $templateRootPath . $template; | |
$viewObject->setTemplatePathAndFilename($templatePathAndFilename); | |
$viewObject->assignMultiple($variables); | |
return $viewObject; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment