NodeInterface
interface NodeInterface (View source)
Interface for a Node. This is the central interface for the Neos Content Repository.
Note: This will be replaced by {\Neos\ContentRepository\Domain\Model\Neos\ContentRepository\Domain\Projection\Content\TraversableNodeInterface} at some point
Constants
MATCH_PATTERN_PATH |
Regex pattern which matches a node path without any context information |
MATCH_PATTERN_CONTEXTPATH |
Regex pattern which matches a "context path", ie. a node path possibly containing context information such as the
workspace name. This pattern is used at least in the route part handler. |
MATCH_PATTERN_NAME |
Regex pattern which matches a Node Name (ie. segment of a node path) |
Methods
Set the name of the node to $newName, keeping it's position as it is
Returns a full length plain text label of this node
Sets the specified property.
If this node has a property with the given name.
Returns the specified property.
Removes the specified property.
Returns all properties of this node.
Returns the names of all properties of this node.
Returns the node type of this node.
Sets the "hidden" flag for this node.
Returns the current state of the hidden flag
Sets the date and time when this node becomes potentially visible.
Returns the date and time before which this node will be automatically hidden.
Sets the date and time when this node should be automatically hidden
Returns the date and time after which this node will be automatically hidden.
Sets if this node should be hidden in indexes, such as a site navigation.
If this node should be hidden in indexes
Returns the absolute path of this node with additional context information (such as the workspace name).
Returns the workspace this node is contained in
Sets the index of this node
Returns the index of this node which determines the order among siblings with the same parent node.
Creates, adds and returns a child node of this node. Also sets default properties and creates default subnodes.
Creates, adds and returns a child node of this node, without setting default properties or creating subnodes.
Creates and persists a node from the given $nodeTemplate as child node
Returns all direct child nodes of this node.
Removes this node and all its child nodes. This is an alias for setRemoved(true)
Removes this node and all its child nodes or sets ONLY this node to not being removed.
If this node is a removed node.
Tells if this node is "visible".
Tells if this node may be accessed according to the current security context.
Tells if a node, in general, has access restrictions, independent of the current security context.
Checks if the given $nodeType would be allowed as a child node of this node according to the configured constraints.
Copies this node to below the given node. The new node will be added behind any existing sub nodes of the given node.
Return the NodeData representation of the node.
Return the context of the node
Return the assigned content dimensions of the node.
Given a context a new node is returned that is like this node, but lives in the new context.
Determine if this node is configured as auto-created childNode of the parent node. If that is the case, it should not be deleted.
Get other variants of this node (with different dimension values)
Details
void
setName(string $newName)
Set the name of the node to $newName, keeping it's position as it is
string
getName()
deprecated
deprecated
Returns the name of this node
string
getLabel()
Returns a full length plain text label of this node
void
setProperty(string $propertyName, mixed $value)
Sets the specified property.
If the node has a content object attached, the property will be set there if it is settable.
bool
hasProperty(string $propertyName)
If this node has a property with the given name.
If the node has a content object attached, the property will be checked there.
mixed
getProperty(string $propertyName)
Returns the specified property.
If the node has a content object attached, the property will be fetched there if it is gettable.
void
removeProperty(string $propertyName)
Removes the specified property.
If the node has a content object attached, the property will not be removed on that object if it exists.
PropertyCollectionInterface
getProperties()
Returns all properties of this node.
If the node has a content object attached, the properties will be fetched there.
string[]
getPropertyNames()
Returns the names of all properties of this node.
void
setContentObject(object $contentObject)
deprecated
deprecated
Sets a content object for this node.
object
getContentObject()
deprecated
deprecated
Returns the content object of this node (if any).
void
unsetContentObject()
deprecated
deprecated
Unsets the content object of this node.
void
setNodeType(NodeType $nodeType)
Sets the node type of this node.
NodeType
getNodeType()
Returns the node type of this node.
void
setHidden(bool $hidden)
Sets the "hidden" flag for this node.
bool
isHidden()
Returns the current state of the hidden flag
void
setHiddenBeforeDateTime(DateTimeInterface $dateTime = null)
Sets the date and time when this node becomes potentially visible.
DateTimeInterface|null
getHiddenBeforeDateTime()
Returns the date and time before which this node will be automatically hidden.
void
setHiddenAfterDateTime(DateTimeInterface $dateTime = null)
Sets the date and time when this node should be automatically hidden
DateTimeInterface|null
getHiddenAfterDateTime()
Returns the date and time after which this node will be automatically hidden.
void
setHiddenInIndex(bool $hidden)
Sets if this node should be hidden in indexes, such as a site navigation.
bool
isHiddenInIndex()
If this node should be hidden in indexes
void
setAccessRoles(array $accessRoles)
deprecated
deprecated
Sets the roles which are required to access this node
array
getAccessRoles()
deprecated
deprecated
Returns the names of defined access roles
string
getPath()
deprecated
deprecated
Returns the path of this node
Example: /sites/mysitecom/homepage/about
string
getContextPath()
Returns the absolute path of this node with additional context information (such as the workspace name).
Example: /sites/mysitecom/homepage/about@user-admin
NOTE: This method will probably be removed at some point. Code should never rely on the exact format of the context path since that might change in the future.
int
getDepth()
deprecated
deprecated
Returns the level at which this node is located.
Counting starts with 0 for "/", 1 for "/foo", 2 for "/foo/bar" etc.
void
setWorkspace(Workspace $workspace)
Sets the workspace of this node.
This method is only for internal use by the content repository. Changing the workspace of a node manually may lead to unexpected behavior.
Workspace
getWorkspace()
Returns the workspace this node is contained in
string
getIdentifier()
deprecated
deprecated
Returns the identifier of this node.
This UUID is not the same as the technical persistence identifier used by Flow's persistence framework. It is an additional identifier which is unique within the same workspace and is used for tracking the same node in across workspaces.
It is okay and recommended to use this identifier for synchronisation purposes as it does not change even if all of the nodes content or its path changes.
void
setIndex(int $index)
Sets the index of this node
This method is for internal use and must only be used by other nodes!
int
getIndex()
Returns the index of this node which determines the order among siblings with the same parent node.
NodeInterface
getParent()
deprecated
deprecated
null
for the root nodeReturns the parent node of this node
string
getParentPath()
deprecated
deprecated
Returns the parent node path
NodeInterface
createNode(string $name, NodeType $nodeType = null, string $identifier = null)
Creates, adds and returns a child node of this node. Also sets default properties and creates default subnodes.
NodeInterface
createSingleNode(string $name, NodeType $nodeType = null, string $identifier = null)
Creates, adds and returns a child node of this node, without setting default properties or creating subnodes.
For internal use only!
NodeInterface
createNodeFromTemplate(NodeTemplate $nodeTemplate, string $nodeName = null)
Creates and persists a node from the given $nodeTemplate as child node
NodeInterface
getNode(string $path)
deprecated
deprecated
Returns a node specified by the given relative path.
NodeInterface
getPrimaryChildNode()
deprecated
deprecated
Returns the primary child node of this node.
Which node acts as a primary child node will in the future depend on theLayeredWorkspacesTest node type. For now it is just the first child node.
NodeInterface[]
getChildNodes(string $nodeTypeFilter = null, int $limit = null, int $offset = null)
deprecated
deprecated
Returns all direct child nodes of this node.
If a node type is specified, only nodes of that type are returned.
bool
hasChildNodes(string $nodeTypeFilter = null)
deprecated
deprecated
Checks if this node has any child nodes.
void
remove()
Removes this node and all its child nodes. This is an alias for setRemoved(true)
void
setRemoved(bool $removed)
Removes this node and all its child nodes or sets ONLY this node to not being removed.
bool
isRemoved()
If this node is a removed node.
bool
isVisible()
Tells if this node is "visible".
For this the "hidden" flag and the "hiddenBeforeDateTime" and "hiddenAfterDateTime" dates are taken into account.
bool
isAccessible()
deprecated
deprecated
Tells if this node may be accessed according to the current security context.
bool
hasAccessRestrictions()
deprecated
deprecated
Tells if a node, in general, has access restrictions, independent of the current security context.
bool
isNodeTypeAllowedAsChildNode(NodeType $nodeType)
Checks if the given $nodeType would be allowed as a child node of this node according to the configured constraints.
void
moveBefore(NodeInterface $referenceNode)
Moves this node before the given node
void
moveAfter(NodeInterface $referenceNode)
Moves this node after the given node
void
moveInto(NodeInterface $referenceNode)
Moves this node into the given node
NodeInterface
copyBefore(NodeInterface $referenceNode, string $nodeName)
Copies this node before the given node
NodeInterface
copyAfter(NodeInterface $referenceNode, string $nodeName)
Copies this node after the given node
NodeInterface
copyInto(NodeInterface $referenceNode, string $nodeName)
Copies this node to below the given node. The new node will be added behind any existing sub nodes of the given node.
NodeData
getNodeData()
internal | This is not meant to be used in userland code |
Return the NodeData representation of the node.
Context
getContext()
internal | This method is not meant to be called in userland code |
Return the context of the node
array
getDimensions()
Return the assigned content dimensions of the node.
NodeInterface
createVariantForContext(Context $context)
Given a context a new node is returned that is like this node, but lives in the new context.
bool
isAutoCreated()
deprecated
deprecated
Determine if this node is configured as auto-created childNode of the parent node. If that is the case, it should not be deleted.
NodeInterface[]
getOtherNodeVariants()
Get other variants of this node (with different dimension values)
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.