LinkingService
class LinkingService (View source)
A service for creating URIs pointing to nodes and assets.
The target node can be provided as string or as a Node object; if not specified at all, the generated URI will refer to the current document node inside the Fusion context.
When specifying the node
argument as string, the following conventions apply:
node
starts with /
:
The given path is an absolute node path and is treated as such.
Example: /sites/acmecom/home/about/us
node
does not start with /
:
The given path is treated as a path relative to the current node.
Examples: given that the current node is /sites/acmecom/products/
,
stapler
results in /sites/acmecom/products/stapler
,
../about
results in /sites/acmecom/about/
,
./neos/info
results in /sites/acmecom/products/neos/info
.
node
starts with a tilde character (~
):
The given path is treated as a path relative to the current site node.
Example: given that the current node is /sites/acmecom/products/
,
~/about/us
results in /sites/acmecom/about/us
,
~
results in /sites/acmecom
.
Constants
PATTERN_SUPPORTED_URIS |
Pattern to match supported URIs. |
Properties
protected AssetRepository | $assetRepository | ||
protected ResourceManager | $resourceManager | ||
protected NodeShortcutResolver | $nodeShortcutResolver | ||
protected PropertyMapper | $propertyMapper | ||
protected NodeInterface | $lastLinkedNode | ||
protected LoggerInterface | $systemLogger | ||
protected NeosNodeServiceInterface | $nodeService | ||
protected SiteRepository | $siteRepository | ||
protected BaseUriProvider | $baseUriProvider |
Methods
No description
No description
Resolves a given node:// URI to a "normal" HTTP(S) URI for the addressed node.
Resolves a given asset:// URI to a "normal" HTTP(S) URI for the addressed asset's resource.
Return the object the URI addresses or NULL.
Renders the URI to a given node instance or -path.
Returns the node that was last used to resolve a link to.
Details
bool
hasSupportedScheme(string|UriInterface $uri)
No description
string
getScheme(string|UriInterface $uri)
No description
string|null
resolveNodeUri(string $uri, NodeInterface $contextNode, ControllerContext $controllerContext, bool $absolute = false)
Resolves a given node:// URI to a "normal" HTTP(S) URI for the addressed node.
string|null
resolveAssetUri(string $uri)
Resolves a given asset:// URI to a "normal" HTTP(S) URI for the addressed asset's resource.
NodeInterface|AssetInterface|null
convertUriToObject(string|UriInterface $uri, NodeInterface $contextNode = null)
Return the object the URI addresses or NULL.
string
createNodeUri(ControllerContext $controllerContext, mixed $node = null, NodeInterface $baseNode = null, string $format = null, bool $absolute = false, array $arguments = [], string $section = '', bool $addQueryString = false, array $argumentsToBeExcludedFromQueryString = [], bool $resolveShortcuts = true)
Renders the URI to a given node instance or -path.
string
createSiteUri(ControllerContext $controllerContext, Site $site)
No description
NodeInterface|null
getLastLinkedNode()
Returns the node that was last used to resolve a link to.
May return NULL in case no link has been generated or an error occurred on the last linking run.