/** * Post-Processor which is called whenever this object is encountered in a Fluid * object access. * * Evaluates TypoScript objects and eel expressions. * * @return TypoScriptPathProxy|mixed */ public function objectAccess() { if (!$this->tsRuntime->canRender($this->path)) { return $this; } try { return $this->tsRuntime->evaluate($this->path, $this->templateImplementation); } catch (\Exception $exception) { return $this->tsRuntime->handleRenderingException($this->path, $exception); } }
/** * Finally evaluate the TypoScript path * * As PHP does not like throwing an exception here, we render any exception using the configured TypoScript exception * handler and will also catch and log any exceptions resulting from that as a last resort. * * @return string */ public function __toString() { try { return (string) $this->tsRuntime->evaluate($this->path); } catch (\Exception $exception) { try { return $this->tsRuntime->handleRenderingException($this->path, $exception); } catch (\Exception $exceptionHandlerException) { try { // Throwing an exception in __toString causes a fatal error, so if that happens we catch them and use the context dependent exception handler instead. $contextDependentExceptionHandler = new \TYPO3\TypoScript\Core\ExceptionHandlers\ContextDependentHandler(); $contextDependentExceptionHandler->setRuntime($this->tsRuntime); return $contextDependentExceptionHandler->handleRenderingException($this->path, $exception); } catch (\Exception $contextDepndentExceptionHandlerException) { $this->systemLogger->logException($contextDepndentExceptionHandlerException, array('path' => $this->path)); return sprintf('<!-- Exception while rendering exception in %s: %s (%s) -->', $this->path, $contextDepndentExceptionHandlerException->getMessage(), $contextDepndentExceptionHandlerException instanceof \TYPO3\Flow\Exception ? 'see reference code ' . $contextDepndentExceptionHandlerException->getReferenceCode() . ' in log' : $contextDepndentExceptionHandlerException->getCode()); } } } }