/**
* Internal evaluation method of absolute $typoScriptPath
*
* @param string $typoScriptPath
* @param string $behaviorIfPathNotFound one of BEHAVIOR_EXCEPTION or BEHAVIOR_RETURNNULL
* @param mixed $contextObject the object which will be "this" in Eel expressions, if any
* @return mixed
*
* @throws StopActionException
* @throws SecurityException
* @throws Exception
* @throws RuntimeException
*/
protected function evaluateInternal($typoScriptPath, $behaviorIfPathNotFound, $contextObject = null)
{
$needToPopContext = false;
$this->lastEvaluationStatus = self::EVALUATION_EXECUTED;
$typoScriptConfiguration = $this->getConfigurationForPath($typoScriptPath);
$cacheContext = $this->runtimeContentCache->enter(isset($typoScriptConfiguration['__meta']['cache']) ? $typoScriptConfiguration['__meta']['cache'] : [], $typoScriptPath);
if (!$this->canRenderWithConfiguration($typoScriptConfiguration)) {
$this->finalizePathEvaluation($cacheContext);
$this->throwExceptionForUnrenderablePathIfNeeded($typoScriptPath, $typoScriptConfiguration, $behaviorIfPathNotFound);
$this->lastEvaluationStatus = self::EVALUATION_SKIPPED;
return null;
}
try {
if ($this->hasExpressionOrValue($typoScriptConfiguration)) {
return $this->evaluteExpressionOrValueInternal($typoScriptPath, $typoScriptConfiguration, $cacheContext, $contextObject);
}
$typoScriptObject = $this->instantiateTypoScriptObject($typoScriptPath, $typoScriptConfiguration);
$needToPopContext = $this->prepareContextForTypoScriptObject($typoScriptObject, $typoScriptPath, $typoScriptConfiguration, $cacheContext);
$output = $this->evaluateObjectOrRetrieveFromCache($typoScriptObject, $typoScriptPath, $typoScriptConfiguration, $cacheContext);
} catch (StopActionException $stopActionException) {
$this->finalizePathEvaluation($cacheContext, $needToPopContext);
throw $stopActionException;
} catch (SecurityException $securityException) {
$this->finalizePathEvaluation($cacheContext, $needToPopContext);
throw $securityException;
} catch (RuntimeException $runtimeException) {
$this->finalizePathEvaluation($cacheContext, $needToPopContext);
throw $runtimeException;
} catch (\Exception $exception) {
$this->finalizePathEvaluation($cacheContext, $needToPopContext);
return $this->handleRenderingException($typoScriptPath, $exception, true);
}
$this->finalizePathEvaluation($cacheContext, $needToPopContext);
return $output;
}