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

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 
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(string $path, $themeCode)

Check configuration in Config file

string
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 53
initialize()

No description

in Singleton at line 48
__clone()

No description

in Singleton at line 53
__wakeup()

No description

at line 62
static addAssetsFromActiveThemeManifest(Assets $manager)

No description

Parameters

Assets $manager

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

No description

Parameters

array $filters
Theme $theme

at line 100
array listThemes()

Returns a list of all themes in the system.

Return Value

array

A list of all themes in the system.

at line 113
loadInstalled()

Loads all installed theme from application config.

at line 125
array loadThemes()

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

Return Value

array

Exceptions

SystemException

at line 143
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 162
bootThemes()

No description

at line 178
getActiveTheme()

No description

at line 184
getActiveThemeCode()

No description

at line 201
Theme findTheme($themeCode)

Returns a theme object based on its name.

Parameters

$themeCode

Return Value

Theme

at line 217
bool hasTheme($themeCode)

Checks to see if an extension has been registered.

Parameters

$themeCode

Return Value

bool

at line 229
string findParent($themeCode)

Returns the theme domain by looking in its path.

Parameters

$themeCode

Return Value

string

at line 243
string findParentCode($themeCode)

Returns the parent theme code.

Parameters

$themeCode

Return Value

string

at line 254
array paths()

Create a Directory Map of all themes

Return Value

array

A list of all themes in the system.

at line 272
bool isActive($themeCode)

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

Parameters

$themeCode

Return Value

bool

at line 288
bool isDisabled($name)

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

Parameters

$name

Return Value

bool

at line 302
bool checkName($themeCode)

Checks to see if a theme has been registered.

Parameters

$themeCode

Return Value

bool

at line 318
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 336
isLocked($themeCode)

No description

Parameters

$themeCode

at line 341
checkParent($themeCode)

No description

Parameters

$themeCode

at line 351
isLockedPath($path)

No description

Parameters

$path

at line 372
string|null findPath($themeCode)

Returns a theme path based on its name.

Parameters

$themeCode

Return Value

string|null

at line 389
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 421
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 433
newFile($filePath, $themeCode)

No description

Parameters

$filePath
$themeCode

at line 457
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 478
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 508
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 531
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 573
bool removeTheme(null $themeCode)

Delete existing theme folder from filesystem.

Parameters

null $themeCode

The theme to delete

Return Value

bool

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

No description

Parameters

$code
$version

at line 605
Themes_model createChildTheme(Themes_model $model)

No description

Parameters

Themes_model $model

Return Value

Themes_model

Exceptions

ApplicationException

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

Read configuration from Config/Meta file

Parameters

string $themeCode

Return Value

array|null

Exceptions

SystemException
FileNotFoundException

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

No description

Parameters

$path
Theme $theme

at line 676
protected array|null validateMetaFile(string $path, $themeCode)

Check configuration in Config file

Parameters

string $path
$themeCode

Return Value

array|null

Exceptions

SystemException
FileNotFoundException

at line 700
protected string writeChildThemeMetaFile($path, $parentTheme, $themeConfig)

No description

Parameters

$path
$parentTheme
$themeConfig

Return Value

string