class FusionService (View source)

The Fusion Service

Properties

protected Parser $fusionParser
protected SiteRepository $siteRepository
protected ObjectManagerInterface $objectManager
protected string $siteRootFusionPattern

Pattern used for determining the Fusion root file for a site

protected string $autoIncludeFusionPattern

Pattern used for determining the Fusion root file for autoIncludes

protected array $prependFusionIncludes

Array of Fusion files to include before the site Fusion

protected array $appendFusionIncludes

Array of Fusion files to include after the site Fusion

protected array $autoIncludeConfiguration
protected NodeTypeManager $nodeTypeManager
protected PackageManager $packageManager

Methods

createRuntime(TraversableNodeInterface $currentSiteNode, ControllerContext $controllerContext)

Create a runtime for the given site node

array
getMergedFusionObjectTree(TraversableNodeInterface $startNode)

Returns a merged Fusion object tree in the context of the given nodes

string
readExternalFusionFile(string $pathAndFilename)

Reads the Fusion file from the given path and filename.

string
generateNodeTypeDefinitions()

Generate Fusion prototype definitions for all node types

string
generateFusionForNodeType(NodeType $nodeType)

Generate a Fusion prototype definition for a given node type

string
getFusionIncludes(array $fusionResources)

Concatenate the given Fusion resources with include statements

array
prepareAutoIncludeFusion()

Prepares an array with Fusion paths to auto include before the Site Fusion.

void
setSiteRootFusionPattern(string $siteRootFusionPattern)

Set the pattern for including the site root Fusion

array
getPrependFusionIncludes()

Get the Fusion resources that are included before the site Fusion.

void
setPrependFusionIncludes(array $prependFusionIncludes)

Set Fusion resources that should be prepended before the site Fusion, it defaults to the Neos Root.fusion Fusion.

array
getAppendFusionIncludes()

Get Fusion resources that will be appended after the site Fusion.

void
setAppendFusionIncludes(array $appendFusionIncludes)

Set Fusion resources that should be appended after the site Fusion, this defaults to an empty array.

Details

Runtime createRuntime(TraversableNodeInterface $currentSiteNode, ControllerContext $controllerContext)

Create a runtime for the given site node

Parameters

TraversableNodeInterface $currentSiteNode
ControllerContext $controllerContext

Return Value

Runtime

Exceptions

Exception
Exception

array getMergedFusionObjectTree(TraversableNodeInterface $startNode)

Returns a merged Fusion object tree in the context of the given nodes

Parameters

TraversableNodeInterface $startNode

Node marking the starting point (i.e. the "Site" node)

Return Value

array

The merged object tree as of the given node

Exceptions

Exception
Exception

protected Site getSiteForSiteNode(TraversableNodeInterface $siteNode)

No description

Parameters

TraversableNodeInterface $siteNode

Return Value

Site

protected string readExternalFusionFile(string $pathAndFilename)

Reads the Fusion file from the given path and filename.

If it doesn't exist, this function will just return an empty string.

Parameters

string $pathAndFilename

Path and filename of the Fusion file

Return Value

string

The content of the .fusion file, plus one chr(10) at the end

protected string generateNodeTypeDefinitions()

Generate Fusion prototype definitions for all node types

Only fully qualified node types (e.g. MyVendor.MyPackage:NodeType) will be considered.

Return Value

string

Exceptions

Exception

protected string generateFusionForNodeType(NodeType $nodeType)

Generate a Fusion prototype definition for a given node type

A prototype will be rendererd with the generator-class defined in the nodeType-configuration 'fusion.prototypeGenerator'

Parameters

NodeType $nodeType

Return Value

string

Exceptions

Exception

protected string getFusionIncludes(array $fusionResources)

Concatenate the given Fusion resources with include statements

Parameters

array $fusionResources

An array of Fusion resource URIs

Return Value

string

A string of include statements for all resources

protected array prepareAutoIncludeFusion()

Prepares an array with Fusion paths to auto include before the Site Fusion.

Return Value

array

void setSiteRootFusionPattern(string $siteRootFusionPattern)

Set the pattern for including the site root Fusion

Parameters

string $siteRootFusionPattern

A string for the sprintf format that takes the site package key as a single placeholder

Return Value

void

array getPrependFusionIncludes()

Get the Fusion resources that are included before the site Fusion.

Return Value

array

void setPrependFusionIncludes(array $prependFusionIncludes)

Set Fusion resources that should be prepended before the site Fusion, it defaults to the Neos Root.fusion Fusion.

Parameters

array $prependFusionIncludes

Return Value

void

array getAppendFusionIncludes()

Get Fusion resources that will be appended after the site Fusion.

Return Value

array

void setAppendFusionIncludes(array $appendFusionIncludes)

Set Fusion resources that should be appended after the site Fusion, this defaults to an empty array.

Parameters

array $appendFusionIncludes

An array of Fusion resource URIs

Return Value

void