class ConvertUrisImplementation extends AbstractFusionObject (View source)

A Fusion Object that converts link references in the format "://" to proper URIs

Right now node:// and asset:// are supported URI schemes.

Usage::

someTextProperty.@process.1 = Neos.Neos:ConvertUris

The optional property forceConversion can be used to have the links converted even when not rendering the live workspace. This is used for links that are not inline editable (for example links on images)::

someTextProperty.@process.1 = Neos.Neos:ConvertUris { forceConversion = true }

The optional property externalLinkTarget can be modified to disable or change the target attribute of the link tag for links to external targets::

prototype(Neos.Neos:ConvertUris) { externalLinkTarget = '_blank' resourceLinkTarget = '_blank' }

The optional property absolute can be used to convert node uris to absolute links::

someTextProperty.@process.1 = Neos.Neos:ConvertUris { absolute = true }

Properties

protected Runtime $runtime from  AbstractFusionObject
protected string $path

The Fusion path currently being rendered

from  AbstractFusionObject
protected string $fusionObjectName

Name of this Fusion object, like Neos.Neos:Text

from  AbstractFusionObject
protected array $fusionValueCache from  AbstractFusionObject
protected LinkingService $linkingService

Methods

__construct(Runtime $runtime, string $path, string $fusionObjectName)

Constructor

mixed
evaluate()

Convert URIs matching a supported scheme with generated URIs

getRuntime()

Get the Fusion runtime this object was created in.

mixed
fusionValue(string $path)

Return the Fusion value relative to this Fusion object (with processors etc applied).

bool
offsetExists(mixed $offset)

Dummy implementation of ArrayAccess to allow this.XXX access in processors.

mixed
offsetGet(mixed $offset)

Dummy implementation of ArrayAccess to allow this.XXX access in processors.

void
offsetSet(mixed $offset, mixed $value)

Dummy implementation of ArrayAccess to allow this.XXX access in processors.

void
offsetUnset(mixed $offset)

Dummy implementation of ArrayAccess to allow this.XXX access in processors.

string
replaceLinkTargets(string $processedContent)

Replace the target attribute of link tags in processedContent with the target specified by externalLinkTarget and resourceLinkTarget options.

Details

__construct(Runtime $runtime, string $path, string $fusionObjectName)

Constructor

Parameters

Runtime $runtime
string $path
string $fusionObjectName

mixed evaluate()

Convert URIs matching a supported scheme with generated URIs

If the workspace of the current node context is not live, no replacement will be done unless forceConversion is set. This is needed to show the editable links with metadata in the content module.

Return Value

mixed

Exceptions

Exception

Runtime getRuntime()

Get the Fusion runtime this object was created in.

Return Value

Runtime

protected mixed fusionValue(string $path)

Return the Fusion value relative to this Fusion object (with processors etc applied).

Note that subsequent calls of fusionValue() with the same Fusion path will return the same values since the first evaluated value will be cached in memory.

Parameters

string $path

Return Value

mixed

bool offsetExists(mixed $offset)

Dummy implementation of ArrayAccess to allow this.XXX access in processors.

Parameters

mixed $offset

Return Value

bool

mixed offsetGet(mixed $offset)

Dummy implementation of ArrayAccess to allow this.XXX access in processors.

Parameters

mixed $offset

Return Value

mixed

void offsetSet(mixed $offset, mixed $value)

Dummy implementation of ArrayAccess to allow this.XXX access in processors.

Parameters

mixed $offset
mixed $value

Return Value

void

void offsetUnset(mixed $offset)

Dummy implementation of ArrayAccess to allow this.XXX access in processors.

Parameters

mixed $offset

Return Value

void

protected string replaceLinkTargets(string $processedContent)

Replace the target attribute of link tags in processedContent with the target specified by externalLinkTarget and resourceLinkTarget options.

Additionally set rel="noopener" for external links.

Parameters

string $processedContent

Return Value

string