Craft Themes (4.x)

RulesService extends Service
in package

Table of Contents

RULES_CACHE_TAG  = 'themes::rules'
$cache  : CacheInterface
$cacheEnabled  : bool
$console  : string|null
$cp  : string|null
$default  : string
$mobileDetect  : MobileDetect
$rules  : array<string|int, mixed>
$setConsole  : bool
$setCp  : bool
flushCache()  : mixed
Flush rules cache
resolveCurrentTheme()  : ThemeInterface|null
Resolve the theme for the current request, get the theme either from cache or from defined theme rules
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
getCache()  : Array|false
Get the cached theme name for a url
getViewPort()  : string
Get user's view port
groupsService()  : GroupsService
Get the groups service
layoutService()  : LayoutService
Get the layout service
matrixService()  : MatrixService
Get the matrix service
resolveLanguageRule()  : bool
Resolves the language part of a rule
resolvePathRule()  : bool
Resolves the path part of a rule
resolveRules()  : string|null
Resolve all defined rules, returns theme name
resolveSiteRule()  : bool
Resolves the site part of a rule
resolveViewPortRule()  : bool
Resolves the view port part of a rule
setCache()  : mixed
Set the theme name cache
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

RULES_CACHE_TAG

public mixed RULES_CACHE_TAG = 'themes::rules'

Properties

Methods

flushCache()

Flush rules cache

public flushCache() : mixed
Return values
mixed

resolveCurrentTheme()

Resolve the theme for the current request, get the theme either from cache or from defined theme rules

public resolveCurrentTheme() : ThemeInterface|null
Return values
ThemeInterface|null

getCache()

Get the cached theme name for a url

protected getCache(string $url, string $viewPort) : Array|false
Parameters
$url : string
$viewPort : string
Return values
Array|false

getViewPort()

Get user's view port

protected getViewPort() : string
Return values
string

matrixService()

Get the matrix service

protected matrixService() : MatrixService
Return values
MatrixService

resolveLanguageRule()

Resolves the language part of a rule

protected resolveLanguageRule(string $ruleLanguage, Locale $locale) : bool
Parameters
$ruleLanguage : string
$locale : Locale
Return values
bool

resolvePathRule()

Resolves the path part of a rule

protected resolvePathRule(string $ruleUrl, string $path) : bool
Parameters
$ruleUrl : string
$path : string
Return values
bool

resolveRules()

Resolve all defined rules, returns theme name

protected resolveRules(string $currentPath, Site $currentSite, string $currentViewPort) : string|null
Parameters
$currentPath : string
$currentSite : Site
$currentViewPort : string
Return values
string|null

resolveSiteRule()

Resolves the site part of a rule

protected resolveSiteRule(string $ruleSite, Site $site) : bool
Parameters
$ruleSite : string
$site : Site
Return values
bool

resolveViewPortRule()

Resolves the view port part of a rule

protected resolveViewPortRule(string $ruleViewPort, string $viewPort) : bool
Parameters
$ruleViewPort : string
$viewPort : string
Return values
bool

setCache()

Set the theme name cache

protected setCache(string $url, string $viewPort, string $themeName) : mixed
Parameters
$url : string
$viewPort : string
$themeName : string
Return values
mixed

triggerEvent()

Triggers an event

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

Search results