ContentContextFactory
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 the context from the given properties. If a context with those properties was already created before then the existing one is returned.
Creates the actual Context instance.
Merges the given context properties with sane defaults for the context implementation.
Provides a way to identify a context to prevent duplicate context objects.
This creates the actual identifier and needs to be overridden by builders extending this.
No description
Removes context properties which have been previously allowed but are not supported anymore and should be silently ignored
No description
No description
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.
protected Context
buildContextInstance(array $contextProperties)
Creates the actual Context instance.
This needs to be overridden if the Builder is extended.
protected array
mergeContextPropertiesWithDefaults(array $contextProperties)
Merges the given context properties with sane defaults for the context implementation.
protected string
getIdentifier(array $contextProperties)
Provides a way to identify a context to prevent duplicate context objects.
protected string
getIdentifierSource(array $contextProperties)
This creates the actual identifier and needs to be overridden by builders extending this.
protected void
validateContextProperties(array $contextProperties)
No description
protected array
removeDeprecatedProperties(array $contextProperties)
Removes context properties which have been previously allowed but are not supported anymore and should be silently ignored
protected ContentDimension[]
getAvailableDimensions()
No description
void
reset()
Reset instances (internal)
protected mixed
mergeTargetDimensionContextProperties(array $contextProperties, array $mergedProperties, array $defaultContextProperties)
No description
protected void
mergeDimensionValues(array $contextProperties, array $mergedProperties)
No description
Context[]
getInstances()
Returns all known instances of Context.
protected array
setDefaultSiteAndDomainFromCurrentRequest(array $defaultContextProperties)
Determines the current domain and site from the request and sets the resulting values as as defaults.