class ThemeManager

Theme Manager Class

Traits

Singleton trait.

Properties

static protected $instance from  Singleton
protected $themeModel
array $installedThemes
array $themes
$activeTheme
protected array $paths
protected $config
protected $loadedConfig
protected $loadedCustomizerConfig
protected $booted
static protected $directories

Methods

static 
instance()

Create a new instance of this singleton.

static 
forgetInstance()

Forget this singleton's instance if it exists

__construct()

Constructor.

initialize()

No description

__clone()

No description

__wakeup()

No description

static 
addDirectory($directory)

No description

static 
addAssetsFromActiveThemeManifest(Assets $manager)

No description

static 
applyAssetVariablesOnCombinerFilters(array $filters, Theme $theme = null)

No description

array
listThemes()

Returns a list of all themes in the system.

loadInstalled()

Loads all installed theme from application config.

array
loadThemes()

Finds all available themes and loads them in to the $themes array.

bool|object
loadTheme(string $themeCode, string $path)

Loads a single theme in to the manager.

bootThemes()

No description

getActiveTheme()

No description

getActiveThemeCode()

No description

findTheme($themeCode)

Returns a theme object based on its name.

bool
hasTheme($themeCode)

Checks to see if an extension has been registered.

string
findParent($themeCode)

Returns the theme domain by looking in its path.

string
findParentCode($themeCode)

Returns the parent theme code.

array
paths()

Create a Directory Map of all themes

bool
isActive($themeCode)

Determines if a theme is activated by looking at the default themes config.

bool
isDisabled($name)

Determines if a theme is disabled by looking at the installed themes config.

bool
checkName($themeCode)

Checks to see if a theme has been registered.

array
listFiles(string $themeCode, string $subFolder = null)

Search a theme folder for files.

isLocked($themeCode)

No description

checkParent($themeCode)

No description

isLockedPath($path)

No description

string|null
findPath($themeCode)

Returns a theme path based on its name.

string|bool
findFile(string $filename, string $themeCode, string $base = null)

Find a file.

readFile(string $filePath, string $themeCode)

Load a single theme generic file into an array. The file will be found by looking in the _layouts, _pages, _partials, _content, themes folders.

newFile($filePath, $themeCode)

No description

bool
writeFile(string $filePath, array $attributes, string $themeCode)

Write an existing theme layout, page, partial or content file.

bool
renameFile(string $filePath, string $newFilePath, string $themeCode)

Rename a theme layout, page, partial or content in the file system.

bool
deleteFile(string $filePath, string $themeCode)

Delete a theme layout, page, partial or content from the file system.

bool
extractTheme(string $zipPath)

Extract uploaded/downloaded theme zip folder

bool
removeTheme(null $themeCode)

Delete existing theme folder from filesystem.

installTheme($code, $version = null)

No description

createChildTheme(Themes_model $model)

No description

array|null
getMetaFromFile(string $themeCode)

Read configuration from Config/Meta file

getFileNameParts($path, Theme $theme)

No description

array|null
validateMetaFile($config, string $path)

Check configuration in Config file

writeChildThemeMetaFile($path, $parentTheme, $themeConfig)

No description

Details

in Singleton at line 18
final static instance()

Create a new instance of this singleton.

in Singleton at line 28
final static forgetInstance()

Forget this singleton's instance if it exists

in Singleton at line 36
final protected __construct()

Constructor.

at line 56
initialize()

No description

in Singleton at line 48
__clone()

No description

in Singleton at line 53
__wakeup()

No description

at line 65
static addDirectory($directory)

No description

Parameters

$directory

at line 70
static addAssetsFromActiveThemeManifest(Assets $manager)

No description

Parameters

Assets $manager

at line 85
static applyAssetVariablesOnCombinerFilters(array $filters, Theme $theme = null)

No description

Parameters

array $filters
Theme $theme

at line 108
array listThemes()

Returns a list of all themes in the system.

Return Value

array

A list of all themes in the system.

at line 121
loadInstalled()

Loads all installed theme from application config.

at line 133
array loadThemes()

Finds all available themes and loads them in to the $themes array.

Return Value

array

Exceptions

SystemException

at line 151
bool|object loadTheme(string $themeCode, string $path)

Loads a single theme in to the manager.

Parameters

string $themeCode

Eg: directory_name

string $path

Ex: base_path().'directory_name';

Return Value

bool|object

Exceptions

SystemException

at line 169
bootThemes()

No description

at line 185
getActiveTheme()

No description

at line 191
getActiveThemeCode()

No description

at line 208
Theme findTheme($themeCode)

Returns a theme object based on its name.

Parameters

$themeCode

Return Value

Theme

at line 224
bool hasTheme($themeCode)

Checks to see if an extension has been registered.

Parameters

$themeCode

Return Value

bool

at line 236
string findParent($themeCode)

Returns the theme domain by looking in its path.

Parameters

$themeCode

Return Value

string

at line 250
string findParentCode($themeCode)

Returns the parent theme code.

Parameters

$themeCode

Return Value

string

at line 261
array paths()

Create a Directory Map of all themes

Return Value

array

A list of all themes in the system.

at line 286
bool isActive($themeCode)

Determines if a theme is activated by looking at the default themes config.

Parameters

$themeCode

Return Value

bool

at line 302
bool isDisabled($name)

Determines if a theme is disabled by looking at the installed themes config.

Parameters

$name

Return Value

bool

at line 316
bool checkName($themeCode)

Checks to see if a theme has been registered.

Parameters

$themeCode

Return Value

bool

at line 332
array listFiles(string $themeCode, string $subFolder = null)

Search a theme folder for files.

Parameters

string $themeCode

The theme to search

string $subFolder

If not null, will return only files within sub-folder (ie 'partials').

Return Value

array $theme_files

at line 350
isLocked($themeCode)

No description

Parameters

$themeCode

at line 355
checkParent($themeCode)

No description

Parameters

$themeCode

at line 365
isLockedPath($path)

No description

Parameters

$path

at line 386
string|null findPath($themeCode)

Returns a theme path based on its name.

Parameters

$themeCode

Return Value

string|null

at line 403
string|bool findFile(string $filename, string $themeCode, string $base = null)

Find a file.

Scans for files located within themes directories. Also scans each theme directories for layouts, partials, and content. Generates fatal error if file not found.

Parameters

string $filename

The file.

string $themeCode

The theme code.

string $base

The folder within the theme eg. layouts, partials, content

Return Value

string|bool

at line 435
TemplateSource readFile(string $filePath, string $themeCode)

Load a single theme generic file into an array. The file will be found by looking in the _layouts, _pages, _partials, _content, themes folders.

Parameters

string $filePath

The name of the file to locate.

string $themeCode

The theme to check.

Return Value

TemplateSource

at line 447
newFile($filePath, $themeCode)

No description

Parameters

$filePath
$themeCode

at line 471
bool writeFile(string $filePath, array $attributes, string $themeCode)

Write an existing theme layout, page, partial or content file.

Parameters

string $filePath

The name of the file to locate.

array $attributes
string $themeCode

The theme to check.

Return Value

bool

at line 492
bool renameFile(string $filePath, string $newFilePath, string $themeCode)

Rename a theme layout, page, partial or content in the file system.

Parameters

string $filePath

The name of the file to locate.

string $newFilePath
string $themeCode

The theme to check.

Return Value

bool

at line 522
bool deleteFile(string $filePath, string $themeCode)

Delete a theme layout, page, partial or content from the file system.

Parameters

string $filePath

The name of the file to locate.

string $themeCode

The theme to check.

Return Value

bool

at line 545
bool extractTheme(string $zipPath)

Extract uploaded/downloaded theme zip folder

Parameters

string $zipPath

The path to the zip folder

Return Value

bool

Exceptions

SystemException

at line 587
bool removeTheme(null $themeCode)

Delete existing theme folder from filesystem.

Parameters

null $themeCode

The theme to delete

Return Value

bool

at line 598
installTheme($code, $version = null)

No description

Parameters

$code
$version

at line 619
Themes_model createChildTheme(Themes_model $model)

No description

Parameters

Themes_model $model

Return Value

Themes_model

Exceptions

ApplicationException

at line 652
array|null getMetaFromFile(string $themeCode)

Read configuration from Config/Meta file

Parameters

string $themeCode

Return Value

array|null

Exceptions

SystemException
FileNotFoundException

at line 674
getFileNameParts($path, Theme $theme)

No description

Parameters

$path
Theme $theme

at line 695
protected array|null validateMetaFile($config, string $path)

Check configuration in Config file

Parameters

$config
string $path

Return Value

array|null

Exceptions

SystemException
FileNotFoundException

at line 714
protected writeChildThemeMetaFile($path, $parentTheme, $themeConfig)

No description

Parameters

$path
$parentTheme
$themeConfig