Craft Themes (3.x)

FileDisplayerInterface extends DisplayerInterface

A file displayer renders an asset. It can handle several file kinds

Table of Contents

CACHE_PREFIX  = 'file'
Prefix used when caching this type of displayers
beforeRender()  : bool
Callback before rendering, returning false will skip the file rendering
eagerLoad()  : array<string|int, string>
Modify eager load map
getCanBeCached()  : bool
Can this displayer be cached
getDescription()  : string
Description/helper shown in CP
getDisplayer()  : FieldDisplayerInterface
Displayer getter
getField()  : FieldInterface
Field getter
getHandle()  : string
Get handle
getHasOptions()  : bool
Does this displayer define options
getKindTargets()  : array<string|int, string>
Which file kind this displayer can handle.
getName()  : string
Get name
getOptions()  : Model
Get options
isDefault()  : bool
Is this displayer the default for an asset kind
setDisplayer()  : mixed
Displayer setter

Constants

CACHE_PREFIX

Prefix used when caching this type of displayers

public mixed CACHE_PREFIX = 'file'

Methods

beforeRender()

Callback before rendering, returning false will skip the file rendering

public beforeRender(Asset $asset) : bool
Parameters
$asset : Asset
Return values
bool

eagerLoad()

Modify eager load map

public eagerLoad(array<string|int, string> $eagerLoad[, string $prefix = '' ], int $level) : array<string|int, string>
Parameters
$eagerLoad : array<string|int, string>
$prefix : string = ''
$level : int
Return values
array<string|int, string>

getCanBeCached()

Can this displayer be cached

public getCanBeCached() : bool
Return values
bool

getDescription()

Description/helper shown in CP

public getDescription() : string
Return values
string

getHandle()

Get handle

public static getHandle() : string
Return values
string

getHasOptions()

Does this displayer define options

public getHasOptions() : bool
Return values
bool

getKindTargets()

Which file kind this displayer can handle.

public static getKindTargets() : array<string|int, string>

Developers should use FileDisplayerService::getKindTargets(string $displayerHandle) instead

'*' is a valid kind and will be resolved to all asset kinds

Return values
array<string|int, string>

isDefault()

Is this displayer the default for an asset kind

public static isDefault(string $kind) : bool
Parameters
$kind : string
Return values
bool

Search results