media
Class:
\CPSIT\
Resolves a file or file reference and runs it through a matching media processor — a pluggable component that turns a resource into whatever shape a template needs (for example, an image with responsive source sets). The extension does not ship any media processors itself; see MediaProcessor for how to register your own.
Data sources
file
is resolved exactly like
object
on
object-access — see Resolving a data payload (dataSource / data)
for the full syntax. It just uses a processor-specific option name instead
of the generic
data.
Usage
tt_content.textpic = HANDLEBARSTEMPLATE
tt_content.textpic {
templateName = @textpic
dataProcessing {
10 = files
10 {
references.fieldName = image
as = files
}
20 = media
20 {
file = processedData:files.0
as = image
config {
image {
# options for a registered "image" media processor
}
}
}
}
}
The first file resolved by the core
files
processor is passed
to
media
, which picks whichever registered media processor's
supports method matches it first — here, a media processor
registered under the name
image
— and stores its result under
image
.
Properties
file- Data source reference the resource is read from (see Data sources). Required.
as- Target key in the processed data array the media processor's result is
stored under. Default:
result. config.<name>- Configuration passed to the media processor registered under
<name>. Only applied if that processor actually matches the resolved resource.
If
file
cannot be resolved, or no registered media processor
supports the resolved resource, a warning is logged and the processed data
is returned unchanged.