Neos\Fusion\Core\Runtime::evaluateEelExpression PHP Метод

evaluateEelExpression() защищенный Метод

Evaluate an Eel expression
protected evaluateEelExpression ( string $expression, AbstractTypoScriptObject $contextObject = null ) : mixed
$expression string The Eel expression to evaluate
$contextObject Neos\Fusion\TypoScriptObjects\AbstractTypoScriptObject An optional object for the "this" value inside the context
Результат mixed The result of the evaluated Eel expression
    protected function evaluateEelExpression($expression, AbstractTypoScriptObject $contextObject = null)
    {
        if ($expression[0] !== '$' || $expression[1] !== '{') {
            // We still assume this is an EEL expression and wrap the markers for backwards compatibility.
            $expression = '${' . $expression . '}';
        }
        $contextVariables = array_merge($this->getDefaultContextVariables(), $this->getCurrentContext());
        if (isset($contextVariables['this'])) {
            throw new Exception('Context variable "this" not allowed, as it is already reserved for a pointer to the current TypoScript object.', 1344325044);
        }
        $contextVariables['this'] = $contextObject;
        if ($this->eelEvaluator instanceof \Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy) {
            $this->eelEvaluator->_activateDependency();
        }
        return EelUtility::evaluateEelExpression($expression, $this->eelEvaluator, $contextVariables);
    }