Runtime
class Runtime (View source)
Fusion Runtime
Fusion Rendering Process
During rendering, all Fusion objects form a tree.
When a Fusion object at a certain $fusionPath is invoked, it has access to all variables stored in the $context (which is an array).
The Fusion object can then add or replace variables to this context using pushContext() or pushContextArray(), before rendering sub-Fusion objects. After rendering these, it must call popContext() to reset the context to the last state.
Constants
BEHAVIOR_EXCEPTION |
Internal constants defining how evaluate should work in case of an error |
BEHAVIOR_RETURNNULL |
|
EVALUATION_EXECUTED |
Internal constants defining a status of how evaluate was evaluated |
EVALUATION_SKIPPED |
|
Properties
protected CompilingEvaluator | $eelEvaluator | ||
protected ObjectManagerInterface | $objectManager | ||
protected array | $contextStack | Stack of evaluated "@context" values |
|
protected array | $currentContext | Reference to the current context |
|
protected array | $currentApplyValues | Reference to the current apply value |
|
protected array | $defaultContextVariables | Default context with helper definitions |
|
protected array | $runtimeConfiguration | ||
protected ControllerContext | $controllerContext | ||
protected array | $settings | ||
protected bool | $debugMode | ||
protected RuntimeContentCache | $runtimeContentCache | ||
protected string | $lastEvaluationStatus |
Methods
Constructor for the Fusion Runtime
Inject settings of this package
Add a tag to the current cache segment
Completely replace the context array with the new $contextArray.
Push a new context object to the rendering stack
Remove the topmost context objects and return them
Get the current context array
No description
No description
Render an absolute Fusion path and return the result.
Handle an Exception thrown while rendering Fusion according to settings specified in Neos.Fusion.rendering.exceptionHandler or {@exceptionHandler}
Determine if the given Fusion path is renderable, which means it exists and has an implementation.
Evaluate an absolute Fusion path and return the result
Does the evaluation of a Fusion instance, first checking the cache and if conditions and afterwards applying processors.
Evaluates an EEL expression or value, checking if conditions first and applying processors.
Possibly prepares a new "@apply" context for the current fusionPath and pushes it to the stack.
Possibly prepares a new context for the current FusionObject and cache context and pushes it to the stack.
Instantiates a Fusion object specified by the given path and configuration
Is the given object an array like object that should get all properties assigned to iterate or process internally
Assigns paths to the Array-Fusion object
Evaluate an Eel expression
Evaluate "@apply" for the given fusion key.
Evaluate processors on given value.
Evaluate eventually existing meta "@if" conditionals inside the given configuration and path.
Returns the context which has been passed by the currently active MVC Controller
Get variables from configuration that should be set in the context by default.
Checks and throws an exception for an unrenderable path.
No description
No description
If the Fusion content cache should be enabled at all
Details
__construct(array $fusionConfiguration, ControllerContext $controllerContext)
Constructor for the Fusion Runtime
void
injectSettings(array $settings)
Inject settings of this package
void
addCacheTag(string $key, string $value)
Add a tag to the current cache segment
During Fusion rendering the method can be used to add tag dynamicaly for the current cache segment.
void
pushContextArray(array $contextArray)
Completely replace the context array with the new $contextArray.
Purely internal method, should not be called outside of Neos.Fusion.
void
pushContext(string $key, mixed $context)
Push a new context object to the rendering stack
array
popContext()
Remove the topmost context objects and return them
array
getCurrentContext()
Get the current context array
void
popApplyValues(array $paths)
No description
string
getLastEvaluationStatus()
No description
mixed
render(string $fusionPath)
Render an absolute Fusion path and return the result.
Compared to $this->evaluate, this adds some more comments helpful for debugging.
string
handleRenderingException(string $fusionPath, Exception $exception, bool $useInnerExceptionHandler = false)
Handle an Exception thrown while rendering Fusion according to settings specified in Neos.Fusion.rendering.exceptionHandler or {@exceptionHandler}
bool
canRender(string $fusionPath)
Determine if the given Fusion path is renderable, which means it exists and has an implementation.
mixed
evaluate(string $fusionPath, mixed $contextObject = null, string $behaviorIfPathNotFound = self::BEHAVIOR_RETURNNULL)
Evaluate an absolute Fusion path and return the result
protected mixed
evaluateObjectOrRetrieveFromCache(AbstractFusionObject $fusionObject, string $fusionPath, array $fusionConfiguration, array $cacheContext)
Does the evaluation of a Fusion instance, first checking the cache and if conditions and afterwards applying processors.
protected mixed
evaluateExpressionOrValueInternal(string $fusionPath, array $fusionConfiguration, AbstractFusionObject $contextObject)
Evaluates an EEL expression or value, checking if conditions first and applying processors.
protected array
prepareApplyValuesForFusionPath(string $fusionPath, array $fusionConfiguration)
Possibly prepares a new "@apply" context for the current fusionPath and pushes it to the stack.
Returns true to express that new properties were pushed and have to be popped during finalizePathEvaluation.
Since "@apply" are not inherited every call of this method leads to a completely new "@apply" context, which is null by default.
protected bool
prepareContextForFusionObject(AbstractFusionObject $fusionObject, string $fusionPath, array $fusionConfiguration, array $cacheContext)
Possibly prepares a new context for the current FusionObject and cache context and pushes it to the stack.
Returns if a new context was pushed to the stack or not.
protected AbstractFusionObject
instantiateFusionObject(string $fusionPath, array $fusionConfiguration, array $applyValuePaths)
Instantiates a Fusion object specified by the given path and configuration
protected bool
shouldAssignPropertiesToFusionObject(AbstractFusionObject $fusionObject)
Is the given object an array like object that should get all properties assigned to iterate or process internally
protected void
assignPropertiesToFusionObject(AbstractArrayFusionObject $fusionObject, array $fusionConfiguration, array $applyValuePaths)
Assigns paths to the Array-Fusion object
protected mixed
evaluateEelExpression(string $expression, AbstractFusionObject $contextObject = null)
Evaluate an Eel expression
protected array|null
evaluateApplyValues(array $configurationWithEventualProperties, string $fusionPath)
Evaluate "@apply" for the given fusion key.
If apply-definitions are found they are evaluated and the returned keys are combined. The result is returned as array with the following structure:
[ 'fusionPath/key_1' => ['key' => 'key_1', 'value' => 'evaluated value 1'], 'fusionPath/key_2' => ['key' => 'key_2', 'value' => 'evaluated value 2'] ]
If no apply-expression is defined null is returned instead.
protected mixed
evaluateProcessors(mixed $valueToProcess, array $configurationWithEventualProcessors, string $fusionPath, AbstractFusionObject $contextObject = null)
Evaluate processors on given value.
protected bool
evaluateIfCondition(array $configurationWithEventualIf, string $configurationPath, AbstractFusionObject $contextObject = null)
Evaluate eventually existing meta "@if" conditionals inside the given configuration and path.
ControllerContext
getControllerContext()
Returns the context which has been passed by the currently active MVC Controller
protected array
getDefaultContextVariables()
Get variables from configuration that should be set in the context by default.
For example Eel helpers are made available by this.
protected
throwExceptionForUnrenderablePathIfNeeded(string $fusionPath, array $fusionConfiguration, string $behaviorIfPathNotFound)
Checks and throws an exception for an unrenderable path.
void
setDebugMode(bool $debugMode)
No description
bool
isDebugMode()
No description
void
setEnableContentCache(bool $flag)
If the Fusion content cache should be enabled at all