ViewModeService
extends Service
in package
Table of Contents
- CONFIG_KEY = 'themes.viewModes'
- DEFAULT_HANDLE = 'default'
- 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'
- VIEWMODE_CACHE_TAG = 'themes::viewMode'
- $_viewModes : Collection
- $cacheTags : array<string|int, string>
- cleanUp() : mixed
- Clean up for layout, deletes old view modes
- create() : ViewModeInterface
- Creates a view mode from config
- delete() : bool
- Deletes a view mode
- get() : ViewModeInterface|null
- Get a view mode
- getAll() : Collection
- Get all view modes
- getById() : ViewModeInterface
- Get view mode by id
- getByUid() : ViewModeInterface
- Get view mode by uid
- getDefault() : ViewModeInterface|null
- Get a default view mode
- getForLayout() : array<string|int, mixed>
- Get all view modes for a layout
- getRecordByUid() : ViewModeRecord
- Get view mode record by uid, or a new one if it's not found
- handleChanged() : mixed
- Handles a change in view mode config
- handleDeleted() : mixed
- Handles a deletion in view mode config
- populateFromData() : ViewModeInterface
- Populates a view mode from an array of data
- rebuildConfig() : mixed
- Respond to rebuild config event
- save() : bool
- Save a view mode
- add() : mixed
- Add a view mode to internal cache
- blockCacheService() : BlockCacheService
- Get the block cache service
- blockProviderService() : BlockProvidersService
- Get the block providers service
- blocksService() : BlockService
- Get the blocks service
- collectCacheTag() : mixed
- Collect a tag for a view mode
- 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.viewModes'
DEFAULT_HANDLE
public
mixed
DEFAULT_HANDLE
= 'default'
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'
VIEWMODE_CACHE_TAG
public
mixed
VIEWMODE_CACHE_TAG
= 'themes::viewMode'
Properties
$_viewModes
protected
Collection
$_viewModes
$cacheTags
protected
array<string|int, string>
$cacheTags
= []
Methods
cleanUp()
Clean up for layout, deletes old view modes
public
cleanUp(array<string|int, mixed> $viewModes, LayoutInterface $layout) : mixed
Parameters
- $viewModes : array<string|int, mixed>
- $layout : LayoutInterface
Return values
mixed —create()
Creates a view mode from config
public
create(array<string|int, mixed>|ViewModeRecord $config) : ViewModeInterface
Parameters
- $config : array<string|int, mixed>|ViewModeRecord
Return values
ViewModeInterface —delete()
Deletes a view mode
public
delete(ViewModeInterface $viewMode[, bool $force = false ]) : bool
Parameters
- $viewMode : ViewModeInterface
- $force : bool = false
Tags
Return values
bool —get()
Get a view mode
public
get(LayoutInterface $layout[, string $handle = self::DEFAULT_HANDLE ]) : ViewModeInterface|null
Parameters
- $layout : LayoutInterface
- $handle : string = self::DEFAULT_HANDLE
Return values
ViewModeInterface|null —getAll()
Get all view modes
public
getAll() : Collection
Return values
Collection —getById()
Get view mode by id
public
getById(int $id) : ViewModeInterface
Parameters
- $id : int
Tags
Return values
ViewModeInterface —getByUid()
Get view mode by uid
public
getByUid(string $uid) : ViewModeInterface
Parameters
- $uid : string
Tags
Return values
ViewModeInterface —getDefault()
Get a default view mode
public
getDefault(LayoutInterface $layout) : ViewModeInterface|null
Parameters
- $layout : LayoutInterface
Return values
ViewModeInterface|null —getForLayout()
Get all view modes for a layout
public
getForLayout(LayoutInterface $layout) : array<string|int, mixed>
Parameters
- $layout : LayoutInterface
Return values
array<string|int, mixed> —getRecordByUid()
Get view mode record by uid, or a new one if it's not found
public
getRecordByUid(string $uid) : ViewModeRecord
Parameters
- $uid : string
Return values
ViewModeRecord —handleChanged()
Handles a change in view mode config
public
handleChanged(ConfigEvent $event) : mixed
Parameters
- $event : ConfigEvent
Return values
mixed —handleDeleted()
Handles a deletion in view mode config
public
handleDeleted(ConfigEvent $event) : mixed
Parameters
- $event : ConfigEvent
Return values
mixed —populateFromData()
Populates a view mode from an array of data
public
populateFromData(array<string|int, mixed> $data) : ViewModeInterface
Parameters
- $data : array<string|int, mixed>
Return values
ViewModeInterface —rebuildConfig()
Respond to rebuild config event
public
rebuildConfig(RebuildConfigEvent $e) : mixed
Parameters
- $e : RebuildConfigEvent
Return values
mixed —save()
Save a view mode
public
save(ViewModeInterface $viewMode[, bool $validate = true ]) : bool
Parameters
- $viewMode : ViewModeInterface
- $validate : bool = true
Tags
Return values
bool —add()
Add a view mode to internal cache
protected
add(ViewModeInterface $viewMode) : mixed
Parameters
- $viewMode : ViewModeInterface
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 —collectCacheTag()
Collect a tag for a view mode
protected
collectCacheTag(ViewModeInterface $viewMode) : mixed
Parameters
- $viewMode : ViewModeInterface
Return values
mixed —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