AdminTheme
extends CFormModel
in package
Admin Theme Model
Tags
Table of Contents
Properties
- $config : mixed
- $name : string
- $path : string
- $sTemplateUrl : string
- $use_asset_manager : bool
- $instance : AdminTheme
Methods
- getAdminThemeList() : array<string|int, mixed>
- Get the list of admin theme, as an array containing each configuration object for each template
- getInstance() : AdminTheme
- Returns the singleton AdminTheme instance, creating and initializing it on first call.
- getOtherAssets() : array<string|int, string>
- registerStylesAndScripts() : mixed
- Load the default admin interface CSS and JavaScript Packages including the admin_theme
- setAdminTheme() : AdminTheme
- Initializes the admin theme for the current request.
- defineConstants() : mixed
- Few constants depending on Template
- getThemeList() : array<string|int, mixed>
- Return an array containing the configuration object of all templates in a given directory
- isStandardAdminTheme() : bool
- Use to check if admin theme is standard
- registerAdminTheme() : void
- Register admin-theme package
Properties
$config
public
mixed
$config
Contains the Admin Theme's configuration file
$name
public
string
$name
Admin Theme's name
$path
public
string
$path
Admin Theme's path
$sTemplateUrl
public
string
$sTemplateUrl
URL to reach Admin Theme (used to get CSS/JS/Files when asset manager is off)
$use_asset_manager
public
static bool
$use_asset_manager
If true, force the use of asset manager even if debug mode is on (useful to debug asset manager's problems)
$instance
private
static AdminTheme
$instance
The instance of theme object
Methods
getAdminThemeList()
Get the list of admin theme, as an array containing each configuration object for each template
public
static getAdminThemeList() : array<string|int, mixed>
Return values
array<string|int, mixed> —the array of configuration object
getInstance()
Returns the singleton AdminTheme instance, creating and initializing it on first call.
public
static getInstance() : AdminTheme
Prefer this over direct instantiation or global variables to ensure the theme is only loaded once per request.
Return values
AdminThemegetOtherAssets()
public
static getOtherAssets() : array<string|int, string>
Return values
array<string|int, string>registerStylesAndScripts()
Load the default admin interface CSS and JavaScript Packages including the admin_theme
public
registerStylesAndScripts() : mixed
Register all the styles and scripts of the current template. Check if RTL is needed, use asset manager if needed. This function is public because it appears that sometime, the package need to be register again in header (probably a cache problem)
setAdminTheme()
Initializes the admin theme for the current request.
public
setAdminTheme() : AdminTheme
Resolves the configured admin theme name (from global settings or config-defaults.php), falls back to Sea_Green if the theme directory does not exist (e.g. after an upgrade or if a custom theme was deleted), then:
- Sets ->name, ->path, ->sTemplateUrl
- Parses config.xml into ->config
- Defines theme constants via defineConstants()
- Registers all CSS/JS assets via registerStylesAndScripts()
Return values
AdminTheme —, to allow chaining from getInstance()
defineConstants()
Few constants depending on Template
private
defineConstants() : mixed
getThemeList()
Return an array containing the configuration object of all templates in a given directory
private
static getThemeList(string $sDir) : array<string|int, mixed>
Parameters
- $sDir : string
-
the directory to scan
Return values
array<string|int, mixed> —the array of object
isStandardAdminTheme()
Use to check if admin theme is standard
private
isStandardAdminTheme(string $sAdminThemeName) : bool
Parameters
- $sAdminThemeName : string
-
the name of the template
Return values
bool —return true if it's a standard template, else false
registerAdminTheme()
Register admin-theme package
private
registerAdminTheme( $files, $aCssFiles) : void