Cms\Classes\ThemeManager

ThemeManager

Protected properties

protected array $themes

themes is for storing installed themes cache

protected array $themeDirs

themes is for storing installed themes cache

protected static $instance

Public methods

public void __clone()

public void __wakeup()

public void deleteTheme($theme)

deleteTheme completely delete a theme from the system

Parameters
  • $theme

public void findByIdentifier($dirName)

findByIdentifier returns a theme object from a directory name

Parameters
  • $dirName

public void findDirectoryName($code)

findDirectoryName from a code

Parameters
  • $code

public void findInstalledCode($dirName)

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

Parameters
  • $dirName

public void findLockableThemes()

findLockableThemes returns themes that are installed via composer

public array findMissingDependencies()

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 static void forgetInstance()

Forget this singleton's instance if it exists

public void getComposerCode($dirName)

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

Parameters
  • $dirName

public void getInstalled()

getInstalled returns a collection of themes installed

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

public void getLatestVersion($dirName)

getLatestVersion finds the latest version for a theme

Parameters
  • $dirName

public void getProductCode($dirName)

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

Parameters
  • $dirName

public void getThemePath($dirName)

getThemePath returns the disk path for the theme

Parameters
  • $dirName

public void getVersionHistory($dirName)

getVersionHistory returns the version history for a theme

Parameters
  • $dirName

public static void instance()

Create a new instance of this singleton.

public void isInstalled($name)

isInstalled checks if a theme has ever been installed

Parameters
  • $name

public void performLockOnTheme($dirName)

performLockOnTheme will add a lock file and create a child theme Returns true if the process was successful

Parameters
  • $dirName

Protected methods

protected void __construct()

Constructor.

protected void getInstalledDirectories()

getInstalled returns a collection of themes installed and their directories

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

protected void init()

Initialize the singleton free from constructor parameters.