Heratio Framework API Reference

DisplayModeService
in package

Service for managing display modes across the application.

Supports both global (admin) and user-level configuration.

Table of Contents

Methods

__construct()  : mixed
canOverride()  : bool
Check if user can override settings.
getAllGlobalSettings()  : Collection
Get all global settings (admin).
getAuditLog()  : Collection
Get audit log.
getContainerClass()  : string
Get CSS class for results container based on mode.
getCurrentMode()  : string
Get current display mode for a module.
getCurrentUserId()  : int
Get current user ID from session if available.
getDisplaySettings()  : array<string|int, mixed>
Get effective display settings for a module.
getItemsPerPage()  : int
Get items per page for module.
getModeMetas()  : array<string|int, mixed>
Get available modes for module with current selection.
getSettingsSource()  : string
Get source of current settings.
getSortSettings()  : array<string|int, mixed>
Get sort settings for module.
hasCustomPreference()  : bool
Check if user has custom preference.
renderToggleButtons()  : string
Build toggle buttons HTML with user override indicator.
resetGlobalSettings()  : bool
Reset global settings to defaults (admin).
resetToGlobal()  : bool
Reset user preference to global/default.
saveGlobalSettings()  : bool
Save global settings for a module (admin).
savePreferences()  : bool
Save user display preferences.
setCurrentUser()  : self
Set the current user ID.
switchMode()  : bool
Switch display mode for current user.

Methods

canOverride()

Check if user can override settings.

public canOverride(string $module) : bool
Parameters
$module : string
Return values
bool

getAllGlobalSettings()

Get all global settings (admin).

public getAllGlobalSettings() : Collection
Return values
Collection

getAuditLog()

Get audit log.

public getAuditLog([array<string|int, mixed> $filters = [] ][, int $limit = 100 ]) : Collection
Parameters
$filters : array<string|int, mixed> = []
$limit : int = 100
Return values
Collection

getContainerClass()

Get CSS class for results container based on mode.

public getContainerClass(string $mode) : string
Parameters
$mode : string
Return values
string

getCurrentMode()

Get current display mode for a module.

public getCurrentMode(string $module) : string
Parameters
$module : string
Return values
string

getCurrentUserId()

Get current user ID from session if available.

public getCurrentUserId() : int
Return values
int

getDisplaySettings()

Get effective display settings for a module.

public getDisplaySettings(string $module) : array<string|int, mixed>

Uses fallback chain: User → Global → Default

Parameters
$module : string
Return values
array<string|int, mixed>

getItemsPerPage()

Get items per page for module.

public getItemsPerPage(string $module) : int
Parameters
$module : string
Return values
int

getModeMetas()

Get available modes for module with current selection.

public getModeMetas(string $module) : array<string|int, mixed>
Parameters
$module : string
Return values
array<string|int, mixed>

getSettingsSource()

Get source of current settings.

public getSettingsSource(string $module) : string
Parameters
$module : string
Return values
string

'user', 'global', or 'default'

getSortSettings()

Get sort settings for module.

public getSortSettings(string $module) : array<string|int, mixed>
Parameters
$module : string
Return values
array<string|int, mixed>

hasCustomPreference()

Check if user has custom preference.

public hasCustomPreference(string $module) : bool
Parameters
$module : string
Return values
bool

renderToggleButtons()

Build toggle buttons HTML with user override indicator.

public renderToggleButtons(string $module[, string $baseUrl = '' ][, bool $useAjax = true ]) : string
Parameters
$module : string
$baseUrl : string = ''
$useAjax : bool = true
Return values
string

resetGlobalSettings()

Reset global settings to defaults (admin).

public resetGlobalSettings(string $module) : bool
Parameters
$module : string
Return values
bool

resetToGlobal()

Reset user preference to global/default.

public resetToGlobal(string $module) : bool
Parameters
$module : string
Return values
bool

saveGlobalSettings()

Save global settings for a module (admin).

public saveGlobalSettings(string $module, array<string|int, mixed> $settings) : bool
Parameters
$module : string
$settings : array<string|int, mixed>
Return values
bool

savePreferences()

Save user display preferences.

public savePreferences(string $module, array<string|int, mixed> $prefs) : bool
Parameters
$module : string
$prefs : array<string|int, mixed>
Return values
bool

setCurrentUser()

Set the current user ID.

public setCurrentUser(int|null $userId) : self
Parameters
$userId : int|null
Return values
self

switchMode()

Switch display mode for current user.

public switchMode(string $module, string $mode) : bool
Parameters
$module : string
$mode : string
Return values
bool

        
On this page

Search results