Commit 6f8e4d04 authored by Stefan Galinski's avatar Stefan Galinski 🎮

[TASK] Make TSFE variable visible

parent 94035ef8
......@@ -26,6 +26,7 @@ namespace SGalinski\ContentReplacer\Service;
***************************************************************/
use SGalinski\ContentReplacer\Repository\TermRepository;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
/**
* Abstract parser that handles the parsing and(!) replacement of terms
......@@ -97,15 +98,18 @@ abstract class AbstractParserService {
* @return string
*/
protected function prepareReplacementTerm($replacement, $stdWrap, $termName) {
/** @var $tsfe TypoScriptFrontendController */
$tsfe = $GLOBALS['TSFE'];
if ($replacement !== '') {
$replacement = $GLOBALS['TSFE']->cObj->parseFunc($replacement, $this->parseFunc);
$replacement = $tsfe->cObj->parseFunc($replacement, $this->parseFunc);
$replacement = preg_replace('/^<p>(.+)<\/p>$/s', '\1', $replacement);
}
if ($stdWrap !== '') {
$replacement = $GLOBALS['TSFE']->cObj->stdWrap(
$replacement = $tsfe->cObj->stdWrap(
($replacement === '' ? $termName : $replacement),
$GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_content_replacer.'][$stdWrap . '.']
$tsfe->tmpl->setup['plugin.']['tx_content_replacer.'][$stdWrap . '.']
);
}
......@@ -152,4 +156,4 @@ abstract class AbstractParserService {
* @return string
*/
abstract public function replaceByCategory($category, array $terms, $content);
}
\ No newline at end of file
}
......@@ -148,4 +148,4 @@ class SpanParserService extends AbstractParserService {
return preg_replace($search, $replace, $content);
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment