Neos\FluidAdaptor\Core\Parser\TemplateProcessor\EscapingFlagProcessor::preProcessSource PHP Method

preProcessSource() public method

Pre-process the template source before it is returned to the TemplateParser or passed to the next TemplateProcessorInterface instance.
public preProcessSource ( string $templateSource ) : string
$templateSource string
return string
    public function preProcessSource($templateSource)
    {
        $matches = [];
        preg_match_all(self::$SCAN_PATTERN_ESCAPINGMODIFIER, $templateSource, $matches, PREG_SET_ORDER);
        if ($matches === []) {
            return $templateSource;
        }
        if (count($matches) > 1) {
            throw new Exception('There is more than one escaping modifier defined. There can only be one {escapingEnabled=...} per template.', 1407331080);
        }
        if (strtolower($matches[0]['enabled']) === 'false') {
            $this->renderingContext->getTemplateParser()->setEscapingEnabled(false);
        }
        $templateSource = preg_replace(self::$SCAN_PATTERN_ESCAPINGMODIFIER, '', $templateSource);
        return $templateSource;
    }