Craft Themes (4.x)

GlobalBlock extends Block
in package

Block displaying a global set

Table of Contents

$active  : bool
$dateCreated  : DateTime
$dateUpdated  : DateTime
$handle  : string
$id  : int
$layout_id  : int
$order  : int
$provider  : string
$region  : string
$uid  : string
$_cacheStrategy  : CacheStrategyInterface
$_cacheStrategyHandle  : string
$_cacheStrategyOptions  : array<string|int, mixed>
$_global  : GlobalSet
$_layout  : LayoutInterface
$_optionsModel  : BlockOptions
afterSave()  : mixed
Callback after the block has been saved
beforeRender()  : bool
Callback before rendering, returning false will skip the block rendering.
defineRules()  : array<string|int, mixed>
fields()  : array<string|int, mixed>
getCacheStrategy()  : BlockCacheStrategyInterface|null
Get the cache strategy for this block
getCanBeCached()  : bool
Can this block be cached
getConfig()  : array<string|int, mixed>
Project config to be saved
getErrors()  : mixed
getGlobalSet()  : GlobalSet|null
Get global set as defined in options
getHandle()  : string
Get block handle
getLayout()  : LayoutInterface
Get layout object
getLongDescription()  : string
Long description getter
getMachineName()  : string
Get full machine name, in the form provider-handle
getName()  : string
getOptions()  : BlockOptions
Get options model
getSmallDescription()  : string
getTemplates()  : array<string|int, string>
Get available templates
getViewMode()  : ViewModeInterface|null
Get the view mode as defined in the options
hasErrors()  : bool
init()  : void
isVisible()  : bool
Is this block visible
provider()  : BlockProviderInterface
Get provider object
render()  : Markup
Render this block
setCacheStrategy()  : mixed
Set the cache strategy, $strategy should be an array : [ 'handle' => 'strategyHandle', 'options' => [] ]
setLayout()  : mixed
Set layout object
setOptions()  : mixed
Options setter
toArray()  : mixed
getOptionsModel()  : string
Model class that defines this block's options

Properties

$active

public bool $active = true

$dateCreated

public DateTime $dateCreated

$dateUpdated

public DateTime $dateUpdated

$layout_id

public int $layout_id

$order

public int $order = 0

$provider

public string $provider

$region

public string $region

$_cacheStrategy

protected CacheStrategyInterface $_cacheStrategy

$_cacheStrategyHandle

protected string $_cacheStrategyHandle

$_cacheStrategyOptions

protected array<string|int, mixed> $_cacheStrategyOptions = []

Methods

afterSave()

Callback after the block has been saved

public afterSave() : mixed
Tags
inheritDoc
Return values
mixed

beforeRender()

Callback before rendering, returning false will skip the block rendering.

public beforeRender() : 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>

getCanBeCached()

Can this block be cached

public getCanBeCached() : bool
Tags
inheritDoc
Return values
bool

getConfig()

Project config to be saved

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

getErrors()

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

getGlobalSet()

Get global set as defined in options

public getGlobalSet() : GlobalSet|null
Return values
GlobalSet|null

getHandle()

Get block handle

public getHandle() : string
Tags
inheritDoc
Return values
string

getLongDescription()

Long description getter

public getLongDescription() : string
Tags
inheritDoc
Return values
string

getMachineName()

Get full machine name, in the form provider-handle

public getMachineName() : string
Tags
inheritDoc
Return values
string

getName()

public getName() : string
Tags
inheritDoc
Return values
string

getSmallDescription()

public getSmallDescription() : string
Tags
inheritDoc
Return values
string

getTemplates()

Get available templates

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

hasErrors()

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

init()

public init() : void
Tags
inheritDoc
Return values
void

isVisible()

Is this block visible

public isVisible() : bool
Tags
inheritDoc
Return values
bool

render()

Render this block

public render() : Markup
Tags
inheritDoc
Return values
Markup

setCacheStrategy()

Set the cache strategy, $strategy should be an array : [ 'handle' => 'strategyHandle', 'options' => [] ]

public setCacheStrategy(mixed $strategy) : mixed
Parameters
$strategy : mixed
Tags
inheritDoc
Return values
mixed

setOptions()

Options setter

public setOptions(mixed $options) : mixed
Parameters
$options : mixed
Tags
inheritDoc
Return values
mixed

toArray()

public toArray([array<string|int, mixed> $fields = [] ][, array<string|int, mixed> $expand = [] ][, mixed $recursive = true ]) : mixed
Parameters
$fields : array<string|int, mixed> = []
$expand : array<string|int, mixed> = []
$recursive : mixed = true
Tags
inheritDoc
Return values
mixed

getOptionsModel()

Model class that defines this block's options

protected getOptionsModel() : string
Tags
inheritDoc
Return values
string

Search results