Craft Themes (3.x)

ViewModeInterface extends HasDisplaysInterface

A view mode has displays associated to it, it's associated to a layout.

One layout can have several view modes.

Table of Contents

addDisplay()  : mixed
Add a display to this view mode
eagerLoad()  : array<string|int, string>
Eager load fields
getAllDisplays()  : array<string|int, DisplayInterface>
Returns all displays, in groups or not
getConfig()  : array<string|int, mixed>
Get project config
getDisplayByHandle()  : DisplayInterface|null
Fetch a display by handle Returns a field or a group type of display
getDisplayByUid()  : DisplayInterface|null
Fetch a display by uid Returns a field or a group type of display
getDisplays()  : array<string|int, DisplayInterface>
Displays getter, will only fetch the root displays (that aren't in groups)
getDisplaysByHandles()  : array<string|int, DisplayInterface>
Fetch displays by handles
getDisplaysByUids()  : array<string|int, DisplayInterface>
Fetch displays by uids
getLayout()  : LayoutInterface
Get layout object
getVisibleDisplays()  : array<string|int, DisplayInterface>
Get all visible displays
setDisplays()  : mixed
Display setter
setLayout()  : mixed
Layout setter

Methods

eagerLoad()

Eager load fields

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

cache tags

Return values
array<string|int, string>

getConfig()

Get project config

public getConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDisplayByHandle()

Fetch a display by handle Returns a field or a group type of display

public getDisplayByHandle(string $handle[, bool $onlyRoots = true ][, bool $onlyVisibles = true ]) : DisplayInterface|null
Parameters
$handle : string
$onlyRoots : bool = true

Only look at root displays (not in groups)

$onlyVisibles : bool = true

Only look at visible displays

Return values
DisplayInterface|null

getDisplayByUid()

Fetch a display by uid Returns a field or a group type of display

public getDisplayByUid(string $uid[, bool $onlyRoots = true ][, bool $onlyVisibles = true ]) : DisplayInterface|null
Parameters
$uid : string
$onlyRoots : bool = true

Only look at root displays (not in groups)

$onlyVisibles : bool = true

Only look at visible displays

Return values
DisplayInterface|null

getDisplaysByHandles()

Fetch displays by handles

public getDisplaysByHandles(array<string|int, string> $handles[, bool $onlyRoots = true ][, bool $onlyVisibles = true ]) : array<string|int, DisplayInterface>
Parameters
$handles : array<string|int, string>
$onlyRoots : bool = true

Only look at root displays (not in groups)

$onlyVisibles : bool = true

Only look at visible displays

Return values
array<string|int, DisplayInterface>

getDisplaysByUids()

Fetch displays by uids

public getDisplaysByUids(array<string|int, string> $uids[, bool $onlyRoots = true ][, bool $onlyVisibles = true ]) : array<string|int, DisplayInterface>
Parameters
$uids : array<string|int, string>
$onlyRoots : bool = true

Only look at root displays (not in groups)

$onlyVisibles : bool = true

Only look at visible displays

Return values
array<string|int, DisplayInterface>

Search results