PHP Class Sulu\Component\Util\SuluNodeHelper

Note this should be removed when we have domain objects.
Show file Open project: sulu/sulu Class Usage Examples

Public Methods

Method Description
__construct ( PHPCR\SessionInterface $session, string $languageNamespace, array $paths )
extractSnippetTypeFromPath ( string $path ) : string Extract the snippet path from the given path.
extractWebspaceFromPath ( string $path ) : string Extracts webspace key from given path.
getLanguagesForNode ( PHPCR\NodeInterface $node ) : array Return the languages that are currently registered on the given PHPCR node.
getLocalizedPropertyValues ( PHPCR\NodeInterface $node, string $name ) Return all the localized values of the localized property indicated by $name.
getNextNode ( PHPCR\NodeInterface $node ) Return the next node of the given node.
getPreviousNode ( PHPCR\NodeInterface $node ) Return the previous node of the given node.
getStructureTypeForNode ( PHPCR\NodeInterface $node ) : string Return the structure type for the given node.
getTranslatedProperty ( Sulu\Component\Content\Compat\PropertyInterface $property, string $locale, string $prefix = null ) : Sulu\Component\Content\Compat\PropertyInterface Return translated property.
getTranslatedPropertyName ( string $propertyName, string $locale ) : string Return translated property name.
hasSuluNodeType ( PHPCR\NodeInterface $node, string | array $suluNodeTypes ) : boolean Return true if the given node has the given nodeType property (or properties).

Private Methods

Method Description
getPath ( string $name ) : string Return the configured named path segment.
getSiblingNode ( PHPCR\NodeInterface $node, boolean $previous = false ) : PHPCR\NodeInterface | null Return either the next or previous sibling of the given node according to the $previous flag.

Method Details

__construct() public method

public __construct ( PHPCR\SessionInterface $session, string $languageNamespace, array $paths )
$session PHPCR\SessionInterface
$languageNamespace string
$paths array Path segments from configuration

extractSnippetTypeFromPath() public method

Extract the snippet path from the given path.
public extractSnippetTypeFromPath ( string $path ) : string
$path string
return string

extractWebspaceFromPath() public method

TODO: We should inject the base path here
public extractWebspaceFromPath ( string $path ) : string
$path string path of node
return string

getLanguagesForNode() public method

Return the languages that are currently registered on the given PHPCR node.
public getLanguagesForNode ( PHPCR\NodeInterface $node ) : array
$node PHPCR\NodeInterface
return array

getLocalizedPropertyValues() public method

Return all the localized values of the localized property indicated by $name.
public getLocalizedPropertyValues ( PHPCR\NodeInterface $node, string $name )
$node PHPCR\NodeInterface
$name string Name of localized property

getNextNode() public method

Return the next node of the given node.
See also: getSiblingNode
public getNextNode ( PHPCR\NodeInterface $node )
$node PHPCR\NodeInterface

getPreviousNode() public method

Return the previous node of the given node.
See also: getSiblingNode
public getPreviousNode ( PHPCR\NodeInterface $node )
$node PHPCR\NodeInterface

getStructureTypeForNode() public method

Return the structure type for the given node.
public getStructureTypeForNode ( PHPCR\NodeInterface $node ) : string
$node PHPCR\NodeInterface
return string

getTranslatedProperty() public method

Return translated property.
public getTranslatedProperty ( Sulu\Component\Content\Compat\PropertyInterface $property, string $locale, string $prefix = null ) : Sulu\Component\Content\Compat\PropertyInterface
$property Sulu\Component\Content\Compat\PropertyInterface
$locale string
$prefix string
return Sulu\Component\Content\Compat\PropertyInterface

getTranslatedPropertyName() public method

Return translated property name.
public getTranslatedPropertyName ( string $propertyName, string $locale ) : string
$propertyName string
$locale string
return string

hasSuluNodeType() public method

The sulu node type is the local name of node types with the sulu namespace. Example: sulu:snippet is the PHPCR node type snippet is the Sulu node type
public hasSuluNodeType ( PHPCR\NodeInterface $node, string | array $suluNodeTypes ) : boolean
$node PHPCR\NodeInterface
$suluNodeTypes string | array One or more node sulu types
return boolean