protected function checkTemplateFile($canUseFlexforms = false)
    {
        if (TYPO3_MODE === 'BE') {
            return;
        }

        $this->checkForNonEmptyString(
            'templateFile',
            $canUseFlexforms,
            's_template_special',
            'This value specifies the HTML template which is essential when ' .
            'creating any output from this extension.'
        );

        if (($this->getFrontEndController() !== null)
            && $this->objectToCheck->hasConfValueString('templateFile', 's_template_special')
        ) {
            $rawFileName = $this->objectToCheck->getConfValueString(
                'templateFile',
                's_template_special',
                true
            );
            if (!is_file($this->getFrontEndController()->tmpl->getFileName($rawFileName))) {
                $message = 'The specified HTML template file <strong>'
                    . htmlspecialchars($rawFileName)
                    . '</strong> cannot be read. '
                    . 'The HTML template file is essential when creating any '
                    . 'output from this extension. '
                    . 'Please either create the file <strong>' . $rawFileName
                    . '</strong> or select an existing file using the TS setup '
                    . 'variable <strong>' . $this->getTSSetupPath()
                    . 'templateFile</strong>';
                if ($canUseFlexforms) {
                    $message .= ' or via FlexForms';
                }
                $message .= '.';
                $this->setErrorMessage($message);
            }
        }
    }