Property | Type | Description | |
---|---|---|---|
$options | Theme-specific options | ||
$parent | Parent theme (optional) | ||
$scripts | Collection of scripts | ||
$styles | Collection of styles |
Method | Description | |
---|---|---|
__construct ( ) | Constructor | |
_getBaseDir ( $path = '' ) : string | Get the base path to be used for file references | |
_getBaseUrl ( $path = '' ) : string | Get the base URL to be used for file paths | |
_registerScripts ( ) : null | Register script assets | |
addOption ( $name, $type, $args = [] ) | Add a theme option | |
addScript ( $name, $script, $args = [] ) | Add a script to load with this theme | |
addStyle ( $name, $style, $args = [] ) | Add a stylesheet to load with this theme | |
getOption ( $name ) : mixed | Get the value of an option or default if the option is not set | |
getOptionConfig ( $name ) : false | array | Get an option's configuration settings | |
getOptionValues ( ) : array | Get all option values | |
getOptionsConfig ( ) : array | Get all options' configuration settings. | |
getScript ( $name ) : array | null | Get a script from this theme or any parent theme | |
getStyle ( $name ) : array | null | Get a style from this theme or any parent theme | |
init ( ) : null | The primary method themes should use to add styles, scripts and fonts, or register hooks. This method is only fired for the currently active theme. | |
initAfter ( ) | Perform actions after the theme has been initialized | |
isActive ( ) : boolean | Determine whether or not this plugin is currently active | |
isColourDark ( $colour, $limit = 130 ) | Check if the passed colour is dark | |
modifyOptionsConfig ( $name, $args = [] ) : boolean | Modify option configuration settings | |
modifyScript ( $name, $args = [] ) : null | Modify the params of an existing script | |
modifyStyle ( $name, $args = [] ) : null | Modify the params of an existing stylesheet | |
readOptionsFormUserVars ( $hookName, $args ) | Retrieve user-entered values for options from any form | |
register ( $category, $path ) | ||
removeOption ( $name ) : boolean | Remove an option | |
removeScript ( $name ) : boolean | Remove a registered script | |
removeStyle ( $name ) : boolean | Remove a registered stylesheet | |
saveOption ( $name, $value, $contextId = null ) | Sanitize and save a theme option | |
saveOptionsForm ( $hookName, $args ) | Save options in any form | |
setParent ( $parent ) : null | Set a parent theme for this theme | |
themeRegistered ( $themes ) : null | Fire the init() method when a theme is registered |
Method | Description | |
---|---|---|
_registerStyles ( ) : null | Register stylesheets and font assets | |
_registerTemplates ( ) : null | Register directories to search for template files |
public _getBaseDir ( $path = '' ) : string | ||
$path | string An optional path to append to the base | |
return | string |
public _getBaseUrl ( $path = '' ) : string | ||
$path | string An optional path to append to the base | |
return | string |
public _registerScripts ( ) : null | ||
return | null |
public addOption ( $name, $type, $args = [] ) | ||
$name | string Unique name for this setting | |
$type | string A pre-registered type of setting. Supported values: text|colour|radio. Default: `text` | |
$args | array Optional parameters defining this setting. Some setting types may accept or require additional arguments. `label` string Locale key for a label for this field. `description` string Locale key for a description for this field. `default` mixed A default value. Default: '' |
public addScript ( $name, $script, $args = [] ) | ||
$name | string A name for this script | |
$script | string The script to be included. Should be path relative to the theme or, if the `inline` argument is included, script data to be output. | |
$args | array Optional arguments hash. Supported args: `context` string Whether to load this on the `frontend` or `backend`. default: frontend `priority` int Controls order in which scripts are printed default: STYLE_SEQUENCE_NORMAL `inline` bool Whether the $script value should be output directly as script data. Used to pass backend data to the scripts. |
public addStyle ( $name, $style, $args = [] ) | ||
$name | string A name for this stylesheet | |
$style | string The stylesheet. Should be a path relative to the theme directory or, if the `inline` argument is included, style data to be output. | |
$args | array Optional arguments hash. Supported args: 'context': Whether to load this on the `frontend` or `backend`. default: `frontend` 'priority': Controls order in which styles are printed 'addLess': Additional LESS files to process before compiling. Array 'addLessVariables': A string containing additional LESS variables to parse before compiling. Example: "@bg:#000;" `inline` bool Whether the $style value should be output directly as style data. |
public getOptionConfig ( $name ) : false | array | ||
$name | The name of the option config to retrieve | |
return | false | array | The config array for this option. Or false if no config is found. |
public getOptionValues ( ) : array | ||
return | array |
public getOptionsConfig ( ) : array | ||
return | array |
public initAfter ( ) |
public isColourDark ( $colour, $limit = 130 ) |
public modifyOptionsConfig ( $name, $args = [] ) : boolean | ||
$name | The name of the option config to retrieve | |
$args | The new configuration settings for this option | |
return | boolean | Whether the option was found and the config was updated. |
public modifyScript ( $name, $args = [] ) : null | ||
$name | string The name of the script to modify | |
$args | array Parameters to modify. | |
return | null |
public modifyStyle ( $name, $args = [] ) : null | ||
$name | string The name of the stylesheet to modify | |
$args | array Parameters to modify. | |
return | null |
public readOptionsFormUserVars ( $hookName, $args ) | ||
$hookName | string | |
$args | array Arguments passed via the hook `form` Form The form object from which option values can be retrieved. `vars` Array Key/value store of the user vars read by the form |
public removeOption ( $name ) : boolean | ||
$name | The name of the option to remove | |
return | boolean | Whether the option was found and removed |
public removeScript ( $name ) : boolean | ||
$name | string The name of the script to remove | |
return | boolean | Whether or not the stylesheet was found and removed. |
public removeStyle ( $name ) : boolean | ||
$name | string The name of the stylesheet to remove | |
return | boolean | Whether or not the stylesheet was found and removed. |
public saveOption ( $name, $value, $contextId = null ) | ||
$name | string A unique id for the option to save | |
$value | mixed The new value to save | |
$contextId | int Optional context id. Defaults to the current context |
public saveOptionsForm ( $hookName, $args ) | ||
$hookName | string | |
$args | array Arguments passed via the hook `form` Form The form object from which option values can be retrieved. `request` Request |
public themeRegistered ( $themes ) : null | ||
$themes | array List of all loaded themes | |
return | null |