Skip to content

Commit

Permalink
Merge pull request #74 from mittwald/feature/#56-fix-typoscript-templ…
Browse files Browse the repository at this point in the history
…ate-config

#56 #72 Use fluid layoutRootPaths and partialRootPaths
  • Loading branch information
kpurrmann authored Feb 21, 2018
2 parents 8565d2f + 38256ed commit fcbaf63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions Classes/Options/ModuleOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ public function __call($methodName, $arguments) {
* @return mixed
*/
protected function getConfigValue($index) {
if (is_array($this->options) && array_key_exists($index, $this->options)) {
if (is_array($this->options) &&
(array_key_exists($index, $this->options) || (($index = $index . '.') && array_key_exists($index, $this->options)))
) {
return $this->options[$index];
}
return NULL;
return null;
}
}
10 changes: 6 additions & 4 deletions Classes/View/PdfView.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;


/**
Expand Down Expand Up @@ -192,11 +193,12 @@ protected function getPdfObject()
protected function getPartial($templateName, $arguments = array())
{
/* @var $partial \TYPO3\CMS\Fluid\View\StandaloneView */
$partial = $this->objectManager->get('TYPO3\CMS\Fluid\View\StandaloneView');
$partial->setLayoutRootPath(GeneralUtility::getFileAbsFileName($this->options->getLayoutRootPath()));
$partial->setPartialRootPath(GeneralUtility::getFileAbsFileName($this->options->getPartialRootPath()));
$partial->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($this->options->getPartialRootPath()) . 'Pdf/' . ucfirst($templateName) . '.html');
$partial = $this->objectManager->get(StandaloneView::class);
$partial->setLayoutRootPaths($this->options->getLayoutRootPaths());
$partial->setPartialRootPaths($this->options->getPartialRootPaths());
$partial->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(end($partial->getPartialRootPaths())) . 'Pdf/' . ucfirst($templateName) . '.html');
$partial->assign('data', $arguments);

return $partial->render();
}

Expand Down
6 changes: 3 additions & 3 deletions Configuration/TypoScript/setup.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugin.tx_web2pdf {
view {
templateRootPath = {$plugin.tx_web2pdf.view.templateRootPath}
partialRootPath = {$plugin.tx_web2pdf.view.partialRootPath}
layoutRootPath = {$plugin.tx_web2pdf.view.layoutRootPath}
templateRootPaths.0 = {$plugin.tx_web2pdf.view.templateRootPath}
partialRootPaths.0 = {$plugin.tx_web2pdf.view.partialRootPath}
layoutRootPaths.0 = {$plugin.tx_web2pdf.view.layoutRootPath}
}

settings {
Expand Down

0 comments on commit fcbaf63

Please sign in to comment.