Craft Themes (3.x)

ViewMode extends Model
in package
implements ViewModeInterface Uses HasDisplays

Class for view modes

Interfaces, Classes and Traits

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

Table of Contents

$dateCreated  : DateTime
$dateUpdated  : DateTime
$handle  : string
$id  : int
$layout_id  : int
$name  : name
$uid  : string
$_displays  : array<string|int, DisplayInterface>
$_layout  : LayoutInterface
addDisplay()  : mixed
Add a display to this view mode
afterValidate()  : mixed
defineRules()  : array<string|int, mixed>
eagerLoad()  : array<string|int, string>
Eager load fields
fields()  : mixed
getAllDisplays()  : array<string|int, mixed>
getConfig()  : array<string|int, mixed>
Get project config
getDisplayByHandle()  : DisplayInterface|null
getDisplayByUid()  : DisplayInterface|null
getDisplays()  : array<string|int, mixed>
getDisplaysByHandles()  : array<string|int, mixed>
getDisplaysByUids()  : array<string|int, mixed>
getErrors()  : mixed
getHasErrors()  : bool
Has errors getter
getLayout()  : LayoutInterface
Get layout object
getVisibleDisplays()  : array<string|int, mixed>
hasErrors()  : mixed
setDisplays()  : mixed
setLayout()  : mixed
Layout setter
loadDisplays()  : array<string|int, mixed>

Properties

$dateCreated

public DateTime $dateCreated

$dateUpdated

public DateTime $dateUpdated

Methods

afterValidate()

public afterValidate() : mixed
Tags
inheritDoc
Return values
mixed

defineRules()

public defineRules() : array<string|int, mixed>
Tags
inheritdoc
Return values
array<string|int, mixed>

eagerLoad()

Eager load fields

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

cache tags

Tags
inheritDoc
Return values
array<string|int, string>

fields()

public fields() : mixed
Tags
inheritDoc
Return values
mixed

getAllDisplays()

public getAllDisplays() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

getConfig()

Get project config

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

getDisplayByHandle()

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

getDisplayByUid()

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

getDisplays()

public getDisplays() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

getDisplaysByHandles()

public getDisplaysByHandles(array<string|int, mixed> $handles[, bool $onlyRoots = true ][, bool $onlyVisibles = true ]) : array<string|int, mixed>
Parameters
$handles : array<string|int, mixed>
$onlyRoots : bool = true
$onlyVisibles : bool = true
Tags
inheritDoc
Return values
array<string|int, mixed>

getDisplaysByUids()

public getDisplaysByUids(array<string|int, mixed> $uids[, bool $onlyRoots = true ][, bool $onlyVisibles = true ]) : array<string|int, mixed>
Parameters
$uids : array<string|int, mixed>
$onlyRoots : bool = true
$onlyVisibles : bool = true
Tags
inheritDoc
Return values
array<string|int, mixed>

getErrors()

public getErrors([mixed $attribute = null ]) : mixed
Parameters
$attribute : mixed = null
Tags
inheritDoc
Return values
mixed

getHasErrors()

Has errors getter

public getHasErrors() : bool
Return values
bool

getVisibleDisplays()

public getVisibleDisplays() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

hasErrors()

public hasErrors([mixed $attribute = null ]) : mixed
Parameters
$attribute : mixed = null
Tags
inheritDoc
Return values
mixed

setDisplays()

public setDisplays(array<string|int, mixed>|null $displays) : mixed
Parameters
$displays : array<string|int, mixed>|null
Tags
inheritDoc
Return values
mixed

loadDisplays()

protected loadDisplays() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

Search results