Craft Themes (3.x)

BlockService extends Service
in package

Table of Contents

CONFIG_KEY  = 'themes.blocks'
EVENT_AFTER_DELETE  = 'after_delete'
EVENT_AFTER_SAVE  = 'after_save'
EVENT_BEFORE_APPLY_DELETE  = 'before_apply_delete'
EVENT_BEFORE_DELETE  = 'before_delete'
EVENT_BEFORE_SAVE  = 'before_save'
$_blocks  : Collection
cleanUp()  : mixed
Clean up for layout, deletes old blocks
create()  : BlockInterface
Creates a block from config
delete()  : bool
Deletes a block
getAll()  : Collection
Get all blocks
getById()  : BlockInterface|null
Get a block by id
getForRegion()  : array<string|int, mixed>
Get blocks for a region
getRecordByUid()  : BlockRecord
Get block record by uid or create a new one if not found
handleChanged()  : mixed
Handles a change in block config
handleDeleted()  : mixed
Handles a deletion in block config
rebuildConfig()  : mixed
Respond to rebuild config event
save()  : bool
Saves a block
validateAll()  : bool
Validates an array of blocks
add()  : mixed
Add a block to internal cache
blockCacheService()  : BlockCacheService
Get the block cache service
blockProviderService()  : BlockProvidersService
Get the block providers service
blocksService()  : BlockService
Get the blocks service
displayService()  : DisplayService
Get the display service
eagerLoadingService()  : EagerLoadingService
Get the eager loading service
fieldDisplayersService()  : FieldDisplayerService
Get the field displayers service
fieldsService()  : FieldsService
Get the fields service
fileDisplayerService()  : FileDisplayerService
Get the file displayers service
groupsService()  : GroupsService
Get the groups service
layoutService()  : LayoutService
Get the layout service
matrixService()  : MatrixService
Get the matrix service
themesRegistry()  : ThemesRegistry
Get the themes registry
triggerEvent()  : mixed
Triggers an event
viewModesService()  : ViewModeService
Get the view mode service
viewService()  : ViewService
Get the view service

Constants

EVENT_AFTER_DELETE

public mixed EVENT_AFTER_DELETE = 'after_delete'

EVENT_AFTER_SAVE

public mixed EVENT_AFTER_SAVE = 'after_save'

EVENT_BEFORE_APPLY_DELETE

public mixed EVENT_BEFORE_APPLY_DELETE = 'before_apply_delete'

EVENT_BEFORE_DELETE

public mixed EVENT_BEFORE_DELETE = 'before_delete'

EVENT_BEFORE_SAVE

public mixed EVENT_BEFORE_SAVE = 'before_save'

Properties

Methods

cleanUp()

Clean up for layout, deletes old blocks

public cleanUp(array<string|int, mixed> $blocks, LayoutInterface $layout) : mixed
Parameters
$blocks : array<string|int, mixed>
$layout : LayoutInterface
Return values
mixed

getAll()

Get all blocks

public getAll() : Collection
Return values
Collection

getForRegion()

Get blocks for a region

public getForRegion(Region $region) : array<string|int, mixed>
Parameters
$region : Region
Return values
array<string|int, mixed>

getRecordByUid()

Get block record by uid or create a new one if not found

public getRecordByUid(string $uid) : BlockRecord
Parameters
$uid : string
Return values
BlockRecord

handleChanged()

Handles a change in block config

public handleChanged(ConfigEvent $event) : mixed
Parameters
$event : ConfigEvent
Return values
mixed

handleDeleted()

Handles a deletion in block config

public handleDeleted(ConfigEvent $event) : mixed
Parameters
$event : ConfigEvent
Return values
mixed

rebuildConfig()

Respond to rebuild config event

public rebuildConfig(RebuildConfigEvent $e) : mixed
Parameters
$e : RebuildConfigEvent
Return values
mixed

validateAll()

Validates an array of blocks

public validateAll(array<string|int, mixed> $blocks) : bool
Parameters
$blocks : array<string|int, mixed>
Return values
bool

matrixService()

Get the matrix service

protected matrixService() : MatrixService
Return values
MatrixService

triggerEvent()

Triggers an event

protected triggerEvent(string $type, Event $event) : mixed
Parameters
$type : string
$event : Event
Return values
mixed

Search results