CoolCMS API

Theme extends Theme
in package

Table of Contents

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getModule()  : string
getName()  : string
getPath()  : string
Theme path: `abs` (disk) or `rel` (web); always with a trailing slash (see `setPath()`).
getSkin()  : string|null
Color variant of the template: a directory in `<variant>/assets/skins/`, or `null` (base look).
getSkinsPath()  : string
Skins directory of the given device variant: `<theme>/<variant>/assets/skins/`.
getVariant()  : string|null
getVariantPath()  : string
setModule()  : $this
setName()  : $this
setPath()  : $this
setSkin()  : $this
setVariant()  : $this
skinExists()  : bool
Returns whether `$skin` is a skin of this theme: a directory with `skin.css`, the same rule as {@see \App\Core\Theme\SkinCatalog}. An empty or half-made directory without the file is not a skin, otherwise the resolver would accept it and render a `<link>` to a 404.
variantExists()  : bool
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Methods

__construct()

public __construct([string $name = '' ][, array<string|int, mixed> $path = ['abs' => '', 'rel' => ''] ][, string|null $variant = 'desktop' ][, string $module = 'admin' ]) : mixed
Parameters
$name : string = ''
$path : array<string|int, mixed> = ['abs' => '', 'rel' => '']
$variant : string|null = 'desktop'
$module : string = 'admin'

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getAllTraits()

Returns all traits the class uses, including those used by parent classes and nested traits.

public getAllTraits() : array<string, string>
Return values
array<string, string>

getModule()

public getModule() : string
Return values
string

getName()

public getName() : string
Return values
string

getPath()

Theme path: `abs` (disk) or `rel` (web); always with a trailing slash (see `setPath()`).

public getPath(string $type) : string
Parameters
$type : string
Return values
string

getSkin()

Color variant of the template: a directory in `<variant>/assets/skins/`, or `null` (base look).

public getSkin() : string|null

NOTE: not to be confused with variant, which means the device (desktop/tablet/mobile) and decides which directory the layouts come from. A skin is only a layer of css variables on top and has no effect on file selection.

Return values
string|null

getSkinsPath()

Skins directory of the given device variant: `<theme>/<variant>/assets/skins/`.

public getSkinsPath([string $type = 'abs' ][, string|null $variant = 'desktop' ]) : string

The canonical location is desktop, hence the default argument. Skins are not duplicated for tablet and mobile: ThemeHelper::getAssetPath() falls back to the desktop file when one is missing, so mobile gets the same skin.

Parameters
$type : string = 'abs'
$variant : string|null = 'desktop'
Return values
string

getVariant()

public getVariant() : string|null
Return values
string|null

getVariantPath()

public getVariantPath([string $type = "abs" ][, string|null $variant = null ]) : string
Parameters
$type : string = "abs"
$variant : string|null = null
Return values
string

setModule()

public setModule(string $module) : $this
Parameters
$module : string
Return values
$this

setName()

public setName(string $name) : $this
Parameters
$name : string
Return values
$this

setPath()

public setPath(array<string|int, mixed> $path) : $this
Parameters
$path : array<string|int, mixed>
Return values
$this

setSkin()

public setSkin(string|null $skin) : $this
Parameters
$skin : string|null
Return values
$this

setVariant()

public setVariant(string|null $variant) : $this
Parameters
$variant : string|null
Return values
$this

skinExists()

Returns whether `$skin` is a skin of this theme: a directory with `skin.css`, the same rule as {@see \App\Core\Theme\SkinCatalog}. An empty or half-made directory without the file is not a skin, otherwise the resolver would accept it and render a `<link>` to a 404.

public skinExists(string $skin[, string|null $variant = 'desktop' ]) : bool

The name is one directory entry (no path separator, no leading dot, like the catalog skips dot entries), so ?_skin= cannot point outside the skins directory.

Parameters
$skin : string
$variant : string|null = 'desktop'
Return values
bool

variantExists()

public variantExists(string $variant) : bool
Parameters
$variant : string
Return values
bool

getTraitsRecursive()

Walks the trait list recursively and collects nested traits too.

private static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
$traits : array<string, string>
Return values
array<string, string>
On this page

Search results