ContentContext
class ContentContext extends Context (View source)
The Content Context
Properties
protected WorkspaceRepository | $workspaceRepository | from Context | |
protected NodeDataRepository | $nodeDataRepository | from Context | |
protected NodeFactory | $nodeFactory | from Context | |
protected ContextFactoryInterface | $contextFactory | from Context | |
protected LoggerInterface | $systemLogger | from Context | |
protected Workspace | $workspace | from Context | |
protected string | $workspaceName | from Context | |
protected DateTime | $currentDateTime | from Context | |
protected bool | $invisibleContentShown | If true, invisible content elements will be shown. |
from Context |
protected bool | $removedContentShown | If true, removed content elements will be shown, even though they are removed. |
from Context |
protected bool | $inaccessibleContentShown | If true, even content elements will be shown which are not accessible by the currently logged in account. |
from Context |
protected array | $dimensions | from Context | |
protected array | $targetDimensions | from Context | |
protected FirstLevelNodeCache | $firstLevelNodeCache | from Context | |
protected Site | $currentSite | ||
protected Domain | $currentDomain | ||
protected NodeInterface | $currentSiteNode | ||
protected PrivilegeManagerInterface | $privilegeManager | ||
protected UserInterfaceModeService | $interfaceRenderModeService |
Methods
Creates a new Content Context object.
Returns the current workspace.
This method is called in order to check if a workspace is accessible.
Returns the current date and time in form of a \DateTime object.
Convenience method returns the root node for this context workspace.
Get a node by identifier and this context
Get all node variants for the given identifier
Finds all nodes lying on the path specified by (and including) the given starting point and end point.
Adopts a node from a (possibly) different context to this context
Tells if nodes which are usually invisible should be accessible through the Node API and queries
Tells if nodes which have their "removed" flag set should be accessible through the Node API and queries
Tells if nodes which have access restrictions should be accessible through the Node API and queries even without the necessary roles / rights
An indexed array of dimensions with ordered list of values for matching nodes by content dimensions
An indexed array of dimensions with a set of values that should be applied when updating or creating
An indexed array of dimensions with a set of values that should be applied when updating or creating
Returns the properties of this context.
Returns the current site from this frontend context
Returns the current domain from this frontend context
Returns the node of the current site.
Returns true if current context is live workspace, false otherwise
Returns true while rendering backend (not live workspace and access to backend granted), false otherwise
No description
Is access to the neos backend granted by current authentications.
Details
__construct(string $workspaceName, DateTimeInterface $currentDateTime, array $dimensions, array $targetDimensions, bool $invisibleContentShown, bool $removedContentShown, bool $inaccessibleContentShown, Site $currentSite = null, Domain $currentDomain = null)
Creates a new Content Context object.
NOTE: This is for internal use only, you should use the ContextFactory for creating Context instances.
Workspace
getWorkspace(bool $createWorkspaceIfNecessary = true)
Returns the current workspace.
void
validateWorkspace(Workspace $workspace)
This method is called in order to check if a workspace is accessible.
At the time of this writing, it is not possible in Flow to restrict access to Workspace through Entity Privileges because Workspaces are used at a very early stage during routing where the security context is not yet initialized. As a workaround, we use a Method Privilege which protects this validateWorkspace() method and thus prevents unauthorized access to a workspace when calling this context's getWorkspace() method.
Since some privilege definitions check the "owner" property of a Workspace, we need a real Workspace object and not just the name - hence this method.
string
getWorkspaceName()
Returns the name of the workspace.
DateTime
getCurrentDateTime()
Returns the current date and time in form of a \DateTime object.
If you use this method for getting the current date and time everywhere in your code, it will be possible to simulate a certain time in unit tests or in the actual application (for realizing previews etc).
NodeInterface
getRootNode()
Convenience method returns the root node for this context workspace.
NodeInterface
getNode(string $path)
Returns a node specified by the given absolute path.
NodeInterface
getNodeByIdentifier(string $identifier)
Get a node by identifier and this context
NodeInterface[]
getNodeVariantsByIdentifier(string $identifier)
Get all node variants for the given identifier
A variant of a node can have different dimension values and path (for non-aggregate nodes). The resulting node instances might belong to a different context.
NodeInterface[]
getNodesOnPath(mixed $startingPoint, mixed $endPoint)
Finds all nodes lying on the path specified by (and including) the given starting point and end point.
NodeInterface
adoptNode(NodeInterface $node, bool $recursive = false)
Adopts a node from a (possibly) different context to this context
Checks if a node variant matching the exact dimensions already exists for this context and return it if found. Otherwise a new node variant for this context is created.
In case the node already exists in the context but does not match the target dimensions a new, more specific node is created and returned.
protected
emitBeforeAdoptNode(NodeInterface $node, Context $context, $recursive)
No description
protected
emitAfterAdoptNode(NodeInterface $node, Context $context, $recursive)
No description
bool
isInvisibleContentShown()
Tells if nodes which are usually invisible should be accessible through the Node API and queries
bool
isRemovedContentShown()
Tells if nodes which have their "removed" flag set should be accessible through the Node API and queries
bool
isInaccessibleContentShown()
Tells if nodes which have access restrictions should be accessible through the Node API and queries even without the necessary roles / rights
array
getDimensions()
An indexed array of dimensions with ordered list of values for matching nodes by content dimensions
array
getTargetDimensions()
An indexed array of dimensions with a set of values that should be applied when updating or creating
array
getTargetDimensionValues()
An indexed array of dimensions with a set of values that should be applied when updating or creating
array
getProperties()
Returns the properties of this context.
FirstLevelNodeCache
getFirstLevelNodeCache()
Not public API!
Site
getCurrentSite()
Returns the current site from this frontend context
Domain
getCurrentDomain()
Returns the current domain from this frontend context
NodeInterface
getCurrentSiteNode()
Returns the node of the current site.
bool
isLive()
Returns true if current context is live workspace, false otherwise
bool
isInBackend()
Returns true while rendering backend (not live workspace and access to backend granted), false otherwise
UserInterfaceMode
getCurrentRenderingMode()
No description
protected bool
hasAccessToBackend()
Is access to the neos backend granted by current authentications.