class ResourceInterceptor implements InterceptorInterface (View source)

This interceptor looks for URIs pointing to package resources and in place of those adds ResourceUriNode instances using the ResourceViewHelper to make those URIs work in the rendered template.

That means you can build your template so that it can be previewed as is and pointers to CSS, JS, images, ... will still work when the resources are mirrored by Flow.

Currently the supported URIs are of the form [../]Public/Some/<Path/To/Resource> (will use current package) [../]/Resources/Public/<Path/To/Resource> (will use given package)

Constants

PATTERN_SPLIT_AT_RESOURCE_URIS

Split a text at what seems to be a package resource URI.

PATTERN_MATCH_RESOURCE_URI

Is the text at hand a resource URI and what are path/package?

Properties

protected string $defaultPackageKey

The default package key to use when rendering resource links without a package key in the source URL.

Methods

void
setDefaultPackageKey(string $defaultPackageKey)

Set the default package key to use for resource URIs.

NodeInterface
process(NodeInterface $node, int $interceptorPosition, ParsingState $parsingState)

Looks for URIs pointing to package resources and in place of those adds ViewHelperNode instances using the ResourceViewHelper.

array
getInterceptionPoints()

This interceptor wants to hook into text nodes.

Details

void setDefaultPackageKey(string $defaultPackageKey)

Set the default package key to use for resource URIs.

Parameters

string $defaultPackageKey

Return Value

void

Exceptions

InvalidArgumentException

NodeInterface process(NodeInterface $node, int $interceptorPosition, ParsingState $parsingState)

Looks for URIs pointing to package resources and in place of those adds ViewHelperNode instances using the ResourceViewHelper.

Parameters

NodeInterface $node
int $interceptorPosition

One of the INTERCEPT_* constants for the current interception point

ParsingState $parsingState

the current parsing state. Not needed in this interceptor.

Return Value

NodeInterface

the modified node

array getInterceptionPoints()

This interceptor wants to hook into text nodes.

Return Value

array

Array of INTERCEPT_* constants