Skip to content

Commit

Permalink
Merge pull request #36 from liayn/fix-35
Browse files Browse the repository at this point in the history
[BUGFIX] Only use TSFE if it is really there
  • Loading branch information
macjohnny authored Feb 6, 2018
2 parents 6ee423a + 22bc70a commit 55999fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Classes/ViewHelpers/DocumentViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use FPDI;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

/**
* DocumentViewHelper
Expand Down Expand Up @@ -72,10 +73,9 @@ public function initializeArguments() {
* @return void
*/
public function initialize() {
if (!isset($GLOBALS['TSFE']->applicationData['tx_pdfviewhelpers'])){
$GLOBALS['TSFE']->applicationData['tx_pdfviewhelpers'] = array();
if (isset($GLOBALS['TSFE']->applicationData)){
$GLOBALS['TSFE']->applicationData['tx_pdfviewhelpers']['pdfOutput'] = true;
}
$GLOBALS['TSFE']->applicationData['tx_pdfviewhelpers']['pdfOutput'] = true;

$extPath = ExtensionManagementUtility::extPath('pdfviewhelpers');
$pdfClassName = empty($this->settings['config']['class']) ? 'TCPDF' : $this->settings['config']['class'];
Expand Down Expand Up @@ -118,7 +118,7 @@ public function initialize() {
}

//Disables cache if set so and in frontend mode
if ($GLOBALS['TSFE'] && $this->settings['config']['disableCache']) {
if ($GLOBALS['TSFE'] instanceof TypoScriptFrontendController && $this->settings['config']['disableCache']) {
$GLOBALS['TSFE']->set_no_cache();
}
}
Expand Down

0 comments on commit 55999fe

Please sign in to comment.