class NodeViewHelper extends AbstractViewHelper (View source)

A view helper for creating URIs pointing to nodes.

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.

= Examples =

<output>
homepage/about.html
(depending on current workspace, current node, format etc.)
</output>

<code title="Generating an absolute URI">
<neos:uri.node absolute="{true"} />
http://www.example.org/homepage/about.html (depending on current workspace, current node, format, host etc.)

<output>
about/us.html
(depending on current workspace, current node, format etc.)
</output>

<code title="Target node given as relative node path">
<neos:uri.node node="~/about/us" />
about/us.html (depending on current workspace, current node, format etc.)


<output>
about/us.html
(depending on current workspace, current node, format etc.)
</output>

Traits

This trait is to be used in ViewHelpers that need to get information from the Fusion runtime context.

Properties

protected LinkingService $linkingService
protected ThrowableStorageInterface $throwableStorage

Methods

mixed
getContextVariable(string $variableName)

Get a variable value from the Fusion runtime context.

bool
hasContextVariable(string $variableName)

No description

void
initializeArguments()

Initialize the arguments.

string
render()

Renders the URI.

Details

protected mixed getContextVariable(string $variableName)

Get a variable value from the Fusion runtime context.

Note: This will return NULL if the variable didn't exist.

Parameters

string $variableName

Return Value

mixed

See also

hasContextVariable()

protected bool hasContextVariable(string $variableName)

No description

Parameters

string $variableName

Return Value

bool

void initializeArguments()

Initialize the arguments.

Return Value

void

Exceptions

Exception

string render()

Renders the URI.

Return Value

string

The rendered URI or NULL if no URI could be resolved for the given node

Exceptions

MissingActionNameException
Exception
Exception