class ContentContextFactory extends ContextFactory (View source)

ContentContextFactory which ensures contexts stay unique. Make sure to get ContextFactoryInterface injected instead of this class.

See \Neos\ContentRepository\Domain\Service\ContextFactory->build for detailed explanations about the usage.

Properties

protected Context[] $contextInstances from  ContextFactory
protected string $contextImplementation

The context implementation this factory will create

protected ContentDimensionRepository $contentDimensionRepository from  ContextFactory
protected Now $now from  ContextFactory
protected Context $securityContext from  ContextFactory
protected DomainRepository $domainRepository
protected SiteRepository $siteRepository

Methods

create(array $contextProperties = [])

Create the context from the given properties. If a context with those properties was already created before then the existing one is returned.

buildContextInstance(array $contextProperties)

Creates the actual Context instance.

array
mergeContextPropertiesWithDefaults(array $contextProperties)

Merges the given context properties with sane defaults for the context implementation.

string
getIdentifier(array $contextProperties)

Provides a way to identify a context to prevent duplicate context objects.

string
getIdentifierSource(array $contextProperties)

This creates the actual identifier and needs to be overridden by builders extending this.

void
validateContextProperties(array $contextProperties)

No description

array
removeDeprecatedProperties(array $contextProperties)

Removes context properties which have been previously allowed but are not supported anymore and should be silently ignored

void
reset()

Reset instances (internal)

mixed
mergeTargetDimensionContextProperties(array $contextProperties, array $mergedProperties, array $defaultContextProperties)

No description

void
mergeDimensionValues(array $contextProperties, array $mergedProperties)

No description

getInstances()

Returns all known instances of Context.

array
setDefaultSiteAndDomainFromCurrentRequest(array $defaultContextProperties)

Determines the current domain and site from the request and sets the resulting values as as defaults.

Details

Context create(array $contextProperties = [])

Create the context from the given properties. If a context with those properties was already created before then the existing one is returned.

The context properties to give depend on the implementation of the context object, for the Neos\ContentRepository\Domain\Service\Context it should look like this:

array( 'workspaceName' => 'live', 'currentDateTime' => new \Neos\Flow\Utility\Now(), 'dimensions' => array(...), 'targetDimensions' => array('language' => 'de', 'persona' => 'Lisa'), 'invisibleContentShown' => false, 'removedContentShown' => false, 'inaccessibleContentShown' => false )

This array also shows the defaults that get used if you don't provide a certain property.

Parameters

array $contextProperties

Return Value

Context

protected Context buildContextInstance(array $contextProperties)

Creates the actual Context instance.

This needs to be overridden if the Builder is extended.

Parameters

array $contextProperties

Return Value

Context

protected array mergeContextPropertiesWithDefaults(array $contextProperties)

Merges the given context properties with sane defaults for the context implementation.

Parameters

array $contextProperties

Return Value

array

protected string getIdentifier(array $contextProperties)

Provides a way to identify a context to prevent duplicate context objects.

Parameters

array $contextProperties

Return Value

string

protected string getIdentifierSource(array $contextProperties)

This creates the actual identifier and needs to be overridden by builders extending this.

Parameters

array $contextProperties

Return Value

string

protected void validateContextProperties(array $contextProperties)

No description

Parameters

array $contextProperties

Return Value

void

Exceptions

InvalidNodeContextException

protected array removeDeprecatedProperties(array $contextProperties)

Removes context properties which have been previously allowed but are not supported anymore and should be silently ignored

Parameters

array $contextProperties

Return Value

array

protected ContentDimension[] getAvailableDimensions()

No description

Return Value

ContentDimension[]

void reset()

Reset instances (internal)

Return Value

void

protected mixed mergeTargetDimensionContextProperties(array $contextProperties, array $mergedProperties, array $defaultContextProperties)

No description

Parameters

array $contextProperties
array $mergedProperties
array $defaultContextProperties

Return Value

mixed

protected void mergeDimensionValues(array $contextProperties, array $mergedProperties)

No description

Parameters

array $contextProperties
array $mergedProperties

Return Value

void

Exceptions

InvalidNodeContextException

Context[] getInstances()

Returns all known instances of Context.

Return Value

Context[]

protected array setDefaultSiteAndDomainFromCurrentRequest(array $defaultContextProperties)

Determines the current domain and site from the request and sets the resulting values as as defaults.

Parameters

array $defaultContextProperties

Return Value

array