Craft Themes (4.x)

GlobalLayout extends Layout
in package
Uses ElementLayout

A layout associated to a global set and a theme

Table of Contents

$dateCreated  : DateTime
$dateUpdated  : DateTime
$elementUid  : string
$hasBlocks  : bool
$id  : id
$name  : string|null
Only used for custom layouts
$parent_id  : int|null
$themeHandle  : string
$uid  : string
$_element  : mixed
Element associated with this layout (entry type, user, category group etc)
$_fieldLayout  : FieldLayout
$_parent  : LayoutInterface|null
$_regionLayoutHandle  : string
$_regions  : array<string|int, RegionInterface>
$_viewModes  : array<string|int, ViewModeInterface>
$fieldLayoutIdAttribute  : string
Attribute that stores the field layout id
addBlock()  : LayoutInterface
Add a block
addViewMode()  : LayoutInterface
Add a view mode
afterValidate()  : mixed
canHaveBlocks()  : bool
Can this layout be assigned blocks
defineRules()  : array<string|int, mixed>
fields()  : array<string|int, mixed>
getBlocks()  : array<string|int, BlockInterface>
Blocks getter
getBlockTemplates()  : array<string|int, mixed>
Get available templates for a block
getConfig()  : array<string|int, mixed>
Get project config
getCraftFields()  : array<string|int, Field>
Get all craft fields defined on this layout's element
getDefaultViewMode()  : ViewModeInterface
Get default view mode
getDescription()  : string
Get description
getEditBlocksUrl()  : string
Get the url to edit blocks.
getEditDisplaysUrl()  : string|null
Get the url to edit displays for a view mode.
getElement()  : mixed
Get element associated to that layout (category group, entry type, User etc)
getErrors()  : mixed
getFieldLayout()  : FieldLayout
Get layout's element field layout
getFieldTemplates()  : array<string|int, mixed>
Get available templates for a field
getFileTemplates()  : array<string|int, mixed>
Get available templates for a file
getGroupTemplates()  : array<string|int, mixed>
Get available templates for a group
getIsCustom()  : bool
Is custom getter
getParent()  : LayoutInterface|null
Parent getter
getRegion()  : Region
Get a region by handle.
getRegionLayout()  : RegionLayoutInterface
Get this layout regions layout
getRegionLayoutHandle()  : string
Get the region layout handle
getRegions()  : array<string|int, RegionInterface>
Get layout regions
getRegionTemplates()  : array<string|int, mixed>
Get available templates for a region
getTemplates()  : array<string|int, mixed>
Get available templates
getTemplatingKey()  : string
Get the portion of template name associated with this element.
getTheme()  : ThemeInterface
Get this layout's theme
getType()  : string
Type getter
getViewMode()  : ViewModeInterface|null
Get view mode by handle
getViewModes()  : array<string|int, ViewModeInterface>
Get view modes defined for that layout
hasDisplays()  : bool
Can this layout define displays.
hasErrors()  : bool
hasRegion()  : bool
Is a region defined
hasViewMode()  : bool
Is a view mode handle defined in this layout
render()  : Markup
Render this layout for an element
renderRegions()  : Markup
Render this layout's regions
setBlocks()  : LayoutInterface
Blocks setter
setElement()  : mixed
Set element associated to that layout
setParent()  : mixed
Parent setter
setRegionLayoutHandle()  : mixed
Set the region layout handle. This will rebuild all the regions, therefore remove all the blocks !
setViewModes()  : LayoutInterface
View modes setter
validateElementUid()  : mixed
Validates elementUid attribute
validateThemeHandle()  : mixed
Validates themeHandle attribute
loadElement()  : mixed
Loads this layout associated element (category group, entry type etc)

Properties

$dateCreated

public DateTime $dateCreated

$dateUpdated

public DateTime $dateUpdated

$elementUid

public string $elementUid

$hasBlocks

public bool $hasBlocks = false

$name

Only used for custom layouts

public string|null $name

$parent_id

public int|null $parent_id

$themeHandle

public string $themeHandle

$_element

Element associated with this layout (entry type, user, category group etc)

protected mixed $_element

$_regionLayoutHandle

protected string $_regionLayoutHandle
Tags
since
5.0.0

$fieldLayoutIdAttribute

Attribute that stores the field layout id

protected string $fieldLayoutIdAttribute = 'fieldLayoutId'

Methods

afterValidate()

public afterValidate() : mixed
Tags
inheritDoc
Return values
mixed

canHaveBlocks()

Can this layout be assigned blocks

public canHaveBlocks() : bool
Tags
inheritDoc
Return values
bool

defineRules()

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

fields()

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

getBlockTemplates()

Get available templates for a block

public getBlockTemplates(BlockInterface $block) : array<string|int, mixed>
Parameters
$block : BlockInterface
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>

getCraftFields()

Get all craft fields defined on this layout's element

public getCraftFields() : array<string|int, Field>
Tags
inheritDoc
Return values
array<string|int, Field>

getDescription()

Get description

public getDescription() : string
Tags
inheritDoc
Return values
string

getEditBlocksUrl()

Get the url to edit blocks.

public getEditBlocksUrl() : string
Tags
inheritDoc
Return values
string

getEditDisplaysUrl()

Get the url to edit displays for a view mode.

public getEditDisplaysUrl([mixed $viewMode = null ]) : string|null
Parameters
$viewMode : mixed = null
Tags
inheritDoc
Return values
string|null

getElement()

Get element associated to that layout (category group, entry type, User etc)

public getElement() : mixed
Tags
inheritDoc
Return values
mixed

getErrors()

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

getFieldLayout()

Get layout's element field layout

public getFieldLayout() : FieldLayout
Tags
inheritDoc
Return values
FieldLayout

getFieldTemplates()

Get available templates for a field

public getFieldTemplates(FieldInterface $field) : array<string|int, mixed>
Parameters
$field : FieldInterface
Tags
inheritDoc
Return values
array<string|int, mixed>

getGroupTemplates()

Get available templates for a group

public getGroupTemplates(GroupInterface $group) : array<string|int, mixed>
Parameters
$group : GroupInterface
Tags
inheritDoc
Return values
array<string|int, mixed>

getIsCustom()

Is custom getter

public getIsCustom() : bool
Return values
bool

getRegion()

Get a region by handle.

public getRegion(string $handle) : Region
Parameters
$handle : string
Tags
inheritDoc
Return values
Region

getRegionLayoutHandle()

Get the region layout handle

public getRegionLayoutHandle() : string
Tags
inheritDoc
Return values
string

getRegionTemplates()

Get available templates for a region

public getRegionTemplates(RegionInterface $region) : array<string|int, mixed>
Parameters
$region : RegionInterface
Tags
inheritDoc
Return values
array<string|int, mixed>

getTemplates()

Get available templates

public getTemplates(ViewModeInterface $viewMode) : array<string|int, mixed>
Parameters
$viewMode : ViewModeInterface
Tags
inheritDoc
Return values
array<string|int, mixed>

getTemplatingKey()

Get the portion of template name associated with this element.

public getTemplatingKey() : string
Tags
inheritDoc
Return values
string

getType()

Type getter

public getType() : string
Tags
inheritDoc
Return values
string

hasDisplays()

Can this layout define displays.

public hasDisplays() : bool
Tags
inheritDoc
Return values
bool

hasErrors()

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

hasRegion()

Is a region defined

public hasRegion(string $handle) : bool
Parameters
$handle : string
Tags
inheritDoc
Return values
bool

hasViewMode()

Is a view mode handle defined in this layout

public hasViewMode(string $handle) : bool
Parameters
$handle : string
Tags
inheritDoc
Return values
bool

render()

Render this layout for an element

public render(Element $element[, mixed $viewMode = ViewModeService::DEFAULT_HANDLE ]) : Markup
Parameters
$element : Element
$viewMode : mixed = ViewModeService::DEFAULT_HANDLE
Tags
inheritDoc
Return values
Markup

renderRegions()

Render this layout's regions

public renderRegions() : Markup
Tags
inheritDoc
Return values
Markup

setBlocks()

Blocks setter

public setBlocks(array<string|int, mixed> $blocks) : LayoutInterface
Parameters
$blocks : array<string|int, mixed>
Tags
inheritDoc
Return values
LayoutInterface

setElement()

Set element associated to that layout

public setElement(mixed $element) : mixed
Parameters
$element : mixed
Tags
inheritDoc
Return values
mixed

setRegionLayoutHandle()

Set the region layout handle. This will rebuild all the regions, therefore remove all the blocks !

public setRegionLayoutHandle(string|null $handle) : mixed
Parameters
$handle : string|null
Tags
inheritDoc
Return values
mixed

setViewModes()

View modes setter

public setViewModes(array<string|int, mixed>|null $viewModes) : LayoutInterface
Parameters
$viewModes : array<string|int, mixed>|null
Tags
inheritDoc
Return values
LayoutInterface

validateElementUid()

Validates elementUid attribute

public validateElementUid() : mixed
Return values
mixed

validateThemeHandle()

Validates themeHandle attribute

public validateThemeHandle() : mixed
Return values
mixed

loadElement()

Loads this layout associated element (category group, entry type etc)

protected loadElement() : mixed
Tags
inheritDoc
Return values
mixed

Search results