class FusionView extends AbstractView (View source)

View for using Fusion for standard MVC controllers.

Recursively loads all Fusion files from the configured path (By default that's Resources/Private/Fusion of the current package) and then checks whether a Fusion object for current controller and action can be found.

If the controller class name is Foo\Bar\Baz\Controller\BlahController and the action is "index", it checks for the Fusion path Foo.Bar.Baz.BlahController.index. If this path is found, then it is used for rendering.

Properties

protected array $supportedOptions

This contains the supported options, their default values, descriptions and types.

protected Parser $fusionParser
protected array $parsedFusion

The parsed Fusion array in its internal representation

protected string $fusionPath

Runtime cache of the Fusion path which should be rendered; derived from the controller and action names or set by the user.

protected RuntimeFactory $runtimeFactory
protected Runtime $fusionRuntime

The Fusion Runtime

Methods

void
setOption(string $optionName, mixed $value)

Reset runtime cache if an option is changed

void
setFusionPath(string $fusionPath)

Sets the Fusion path to be rendered to an explicit value; to be used mostly inside tests.

void
setPackageKey(string $packageKey)

The package key where the Fusion should be loaded from. If not given, is automatically derived from the current request.

void
setFusionPathPattern(string $pathPattern)

No description

void
setFusionPathPatterns(array $pathPatterns)

No description

mixed
render()

Render the view

void
initializeFusionRuntime()

Load the Fusion Files form the defined paths and construct a Runtime from the parsed results

void
loadFusion()

Load Fusion from the directories specified by $this->getOption('fusionPathPatterns')

array
getMergedFusionObjectTree()

Parse all the fusion files the are in the current fusionPathPatterns

array
getFusionPathPatterns()

Get the currently configured fusion path patterns @package is replaced by the current package key

string
getPackageKey()

Get the package key to load the Fusion from. If set, $this->getOption('packageKey') is used.

string
getFusionPathForCurrentRequest()

Determines the Fusion path depending on the current controller and action

mixed
renderFusion()

Render the given Fusion and return the rendered page

Details

void setOption(string $optionName, mixed $value)

Reset runtime cache if an option is changed

Parameters

string $optionName
mixed $value

Return Value

void

void setFusionPath(string $fusionPath)

Sets the Fusion path to be rendered to an explicit value; to be used mostly inside tests.

Parameters

string $fusionPath

Return Value

void

void setPackageKey(string $packageKey)

The package key where the Fusion should be loaded from. If not given, is automatically derived from the current request.

Parameters

string $packageKey

Return Value

void

void setFusionPathPattern(string $pathPattern)

No description

Parameters

string $pathPattern

Return Value

void

void setFusionPathPatterns(array $pathPatterns)

No description

Parameters

array $pathPatterns

Return Value

void

mixed render()

Render the view

Return Value

mixed

The rendered view

void initializeFusionRuntime()

Load the Fusion Files form the defined paths and construct a Runtime from the parsed results

Return Value

void

protected void loadFusion()

Load Fusion from the directories specified by $this->getOption('fusionPathPatterns')

Return Value

void

protected array getMergedFusionObjectTree()

Parse all the fusion files the are in the current fusionPathPatterns

Return Value

array

array getFusionPathPatterns()

Get the currently configured fusion path patterns @package is replaced by the current package key

Return Value

array

protected string getPackageKey()

Get the package key to load the Fusion from. If set, $this->getOption('packageKey') is used.

Otherwise, the current request is taken and the controller package key is extracted from there.

Return Value

string

the package key to load Fusion from

protected string getFusionPathForCurrentRequest()

Determines the Fusion path depending on the current controller and action

Return Value

string

protected mixed renderFusion()

Render the given Fusion and return the rendered page

Return Value

mixed

Exceptions

Exception