Cms\Classes\ThemeManager


Protected Properties

protected array $themes

installedThemes is for storing installed themes cache

protected array $installedThemes

installedThemes is for storing installed themes cache

protected array $installedThemeDirs

installedThemeDirs is for storing installed themes cache


Public Methods

public bootAllBackend()

public bootAllBackend(): void

bootAllBackend will boot language messages for the active theme as theme.acme::lang.*

public bootAllFrontend()

public bootAllFrontend(): void

public createChildTheme()

public createChildTheme($dirName, $newDirName = null): bool 

createChildTheme will create a child theme

public deleteTheme()

public deleteTheme($theme): void

deleteTheme completely delete a theme from the system

public duplicateTheme()

public duplicateTheme($dirName, $newDirName = null): bool 

duplicateTheme duplicates a theme

public findByIdentifier()

public findByIdentifier($dirName): Cms\Classes\Theme|null 

findByIdentifier returns a theme object from a directory name

public findDirectoryName()

public findDirectoryName($code): string|null 

findDirectoryName from a code

public findInstalledCode()

public findInstalledCode($dirName): string|null 

findInstalledCode returns an installed theme's code from it's dirname

public findLockableThemes()

public findLockableThemes(): array 

findLockableThemes returns themes that are installed via composer

public findMissingDependencies()

public findMissingDependencies(): array 

findMissingDependencies scans the system plugins to locate any dependencies that are not currently installed. Returns an array of plugin codes that are needed.

ThemeManager::instance()->findMissingDependencies();

public getActiveTheme()

public getActiveTheme(): Cms\Classes\Theme 

getActiveTheme return the active theme without affecting the internal cache since it may fire before the session driver has loaded.

public getComposerCode()

public getComposerCode($dirName): string 

getComposerCode finds the composer code for a theme author/sometheme-theme

public getInstalled()

public getInstalled(): array 

getInstalled returns a collection of themes installed

['RainLab.Vanilla' => '1.0.0', ...]

public getLatestVersion()

public getLatestVersion($dirName): string 

getLatestVersion finds the latest version for a theme

public getProductCode()

public getProductCode($dirName): string 

getProductCode finds the product code for a theme, it relies on the composer file as the source of truth author.sometheme

public getThemePath()

public getThemePath($dirName): string 

getThemePath returns the disk path for the theme

public getThemes()

public getThemes(): array 

getThemes returns all themes in the filesystem

public getVersionHistory()

public getVersionHistory($dirName): array 

getVersionHistory returns the version history for a theme

public importDatabaseTemplates()

public importDatabaseTemplates($dirName, $srcDirName = null): void

public static instance()

public static instance(): static 

instance creates a new instance of this singleton

public isInstalled()

public isInstalled($name): bool 

isInstalled checks if a theme has ever been installed

public performLockOnTheme()

public performLockOnTheme($dirName): bool 

performLockOnTheme will add a lock file on a theme Returns true if the process was successful

public performUnlockOnTheme()

public performUnlockOnTheme($dirName): bool 

performUnlockOnTheme will remove the lock file on a theme Returns true if the process was successful

public purgeDatabaseTemplates()

public purgeDatabaseTemplates($dirName): void

Protected Methods

protected getInstalledDirectories()

protected getInstalledDirectories(): array 

getInstalled returns a collection of themes installed and their directories

['rainlab.vanilla' => 'vanilla', ...]