Install theme through package upgrade does nothing

(v9.2.7) If i want to install an additional theme this way nothing happens.

public function upgrade() 
{
	$pkg = parent::upgrade();

        $projectTheme = Theme::getByHandle('project_theme');
        if (!$projectTheme) {
// the process does get here in upgrading 
            Theme::add('project_theme', $pkg);
        }
}

If i do a clean install both themes get installed:

public function install()
{
	$pkg = parent::install();
	Theme::add('first_theme', $pkg);
	Theme::add('project_theme', $pkg);
}

What’s wrong here?

I believe your issue is that parent::upgrade() doesn’t return anything.

Try something like this:

public function upgrade() 
{
        parent::upgrade();

        $pkg = $this->app->make('Concrete\Core\Package\PackageService')->getByHandle($this->pkgHandle);

        $projectTheme = Theme::getByHandle('project_theme');
        if (!$projectTheme) {
            Theme::add('project_theme', $pkg);
        }
}
2 Likes

Thanks, sometimes it’s just a quick and easy solution. :rofl: