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
CONFIG_KEY
public
mixed
CONFIG_KEY
= 'themes.blocks'
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
$_blocks
protected
Collection
$_blocks
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 —create()
Creates a block from config
public
create(array<string|int, mixed>|ActiveRecord $config) : BlockInterface
Parameters
- $config : array<string|int, mixed>|ActiveRecord
Tags
Return values
BlockInterface —delete()
Deletes a block
public
delete(BlockInterface $block) : bool
Parameters
- $block : BlockInterface
Return values
bool —getAll()
Get all blocks
public
getAll() : Collection
Return values
Collection —getById()
Get a block by id
public
getById(int $id) : BlockInterface|null
Parameters
- $id : int
Return values
BlockInterface|null —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 —save()
Saves a block
public
save(BlockInterface $block[, bool $validate = true ]) : bool
Parameters
- $block : BlockInterface
- $validate : bool = true
Return values
bool —validateAll()
Validates an array of blocks
public
validateAll(array<string|int, mixed> $blocks) : bool
Parameters
- $blocks : array<string|int, mixed>
Return values
bool —add()
Add a block to internal cache
protected
add(BlockInterface $block) : mixed
Parameters
- $block : BlockInterface
Return values
mixed —blockCacheService()
Get the block cache service
protected
blockCacheService() : BlockCacheService
Return values
BlockCacheService —blockProviderService()
Get the block providers service
protected
blockProviderService() : BlockProvidersService
Return values
BlockProvidersService —blocksService()
Get the blocks service
protected
blocksService() : BlockService
Return values
BlockService —displayService()
Get the display service
protected
displayService() : DisplayService
Return values
DisplayService —eagerLoadingService()
Get the eager loading service
protected
eagerLoadingService() : EagerLoadingService
Return values
EagerLoadingService —fieldDisplayersService()
Get the field displayers service
protected
fieldDisplayersService() : FieldDisplayerService
Return values
FieldDisplayerService —fieldsService()
Get the fields service
protected
fieldsService() : FieldsService
Return values
FieldsService —fileDisplayerService()
Get the file displayers service
protected
fileDisplayerService() : FileDisplayerService
Return values
FileDisplayerService —groupsService()
Get the groups service
protected
groupsService() : GroupsService
Return values
GroupsService —layoutService()
Get the layout service
protected
layoutService() : LayoutService
Return values
LayoutService —matrixService()
Get the matrix service
protected
matrixService() : MatrixService
Return values
MatrixService —themesRegistry()
Get the themes registry
protected
themesRegistry() : ThemesRegistry
Return values
ThemesRegistry —triggerEvent()
Triggers an event
protected
triggerEvent(string $type, Event $event) : mixed
Parameters
- $type : string
- $event : Event
Return values
mixed —viewModesService()
Get the view mode service
protected
viewModesService() : ViewModeService
Return values
ViewModeService —viewService()
Get the view service
protected
viewService() : ViewService