Craft Themes (4.x)

Region extends Model
in package
implements RegionInterface

Class for a region inside a theme

Interfaces, Classes and Traits

RegionInterface
Regions are defined by themes, and are assigned to layouts. They can have blocks.

Table of Contents

$handle  : string
$layout  : LayoutInterface
$name  : string
$width  : string
$_blocks  : array<string|int, BlockInterface>
addBlock()  : mixed
Add a block to this region
beforeRender()  : bool
Callback before rendering, returning false will skip the region rendering
getBlocks()  : array<string|int, BlockInterface>
Blocks getter
getTemplates()  : array<string|int, string>
Get available templates
getTheme()  : ThemeInterface
Theme getter
getVisibleBlocks()  : array<string|int, BlockInterface>
Get visible blocks
hasBlocks()  : bool
Does this region have blocks
hasVisibleBlocks()  : bool
Does this region have visible blocks
render()  : Markup
Render this region
setBlocks()  : mixed
Blocks setter

Properties

$handle

public string $handle = ''

$width

public string $width = '100%'

Methods

beforeRender()

Callback before rendering, returning false will skip the region rendering

public beforeRender() : bool
Tags
inheritDoc
Return values
bool

getTemplates()

Get available templates

public getTemplates(LayoutInterface $layout) : array<string|int, string>
Parameters
$layout : LayoutInterface
Tags
inheritDoc
Return values
array<string|int, string>

hasBlocks()

Does this region have blocks

public hasBlocks() : bool
Tags
inheritDoc
Return values
bool

hasVisibleBlocks()

Does this region have visible blocks

public hasVisibleBlocks() : bool
Tags
inheritDoc
Return values
bool

render()

Render this region

public render() : Markup
Tags
inheritDoc
Return values
Markup

setBlocks()

Blocks setter

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

Search results