Changes the current theme

@param ThemeInterface $previousTheme
@param ThemeInterface $theme
@param string           $path
@param array            $templatesMap
182137
public function change(ThemeInterface $previousTheme, ThemeInterface $theme, $path, array $templatesMap)
    {
        $this->saveThemeStructure($previousTheme, $path);
        $this->changeTemplate($theme, $templatesMap);
    }
103165
public function addPath($path, $namespace = null)
    {
        $key = (is_null($namespace)) ? $path : $namespace . '::' . $path;

        $this->fullQualifiedPathNameWithTemplatePath[$key] = new TemplatePath($path, $namespace);
    }
292310
public function setCustomPageTheme(PageTheme $pt)
    {
        $this->themeObject = $pt;
        $this->themePkgHandle = $pt->getPackageHandle();
    }
974886
private function convertParentsNamesToParentsObjects($themeName, array $parentsNames, array $existingThemes)
    {
        return array_map(static function ($parentName) use ($themeName, $existingThemes) {
            if (!isset($existingThemes[$parentName])) {
                throw new ThemeLoadingFailedException(sprintf(
                    'Unexisting theme "%s" is required by "%s".',
                    $parentName,
                    $themeName
                ));
            }

            return $existingThemes[$parentName];
        }, $parentsNames);
    }
610491
public function templatePath($path = null)
    {
        deprecationWarning('ViewBuilder::templatePath() is deprecated. Use ViewBuilder::setTemplatePath() or ViewBuilder::getTemplatePath() instead.');
        if ($path !== null) {
            return $this->setTemplatePath($path);
        }

        return $this->getTemplatePath();
    }
502839
public function refresh(ThemeSlotsInterface $themeSlots, Template $template = null, PageBlocksInterface $pageBlocks = null)
    {
        $this->themeSlots = $themeSlots;
        $this->template = $template;
        $this->pageBlocks = $pageBlocks;

        $this->setUpSlotManagers();

        return $this;
    }
976601
public function setThemeByRoute($path, $theme = null, $wrapper = FILENAME_THEMES_VIEW)
    {
        $this->themePaths[$path] = array($theme, $wrapper);
    }
677777
public static function registerTheme($theme)
    {
        if (in_array($theme, self::$_registeredThemes)) {
            throw new Exception(__d('wasabi_cms', 'The Theme "{0}" is already registered.', $theme));
        }

        self::$_registeredThemes[] = $theme;
    }
440598
public function setTheme($theme, $themeFolder = ThemesManager::THEMES_FOLDER) {
		$path = \ROOT . \DS . 'views' . \DS . $themeFolder . \DS . $theme;
		if ($theme == '') {
			$path = \ROOT . \DS . 'views';
		}
		if (file_exists ( $path )) {
			$this->loader->setPaths ( [ $path ], "activeTheme" );
		} else {
			throw new ThemesException ( sprintf ( 'The path `%s` does not exists!', $path ) );
		}
	}
42524
protected function createBlankSite($path, PackageNameVersion $themePair)
    {
        $themeName = '';
        $packagePairs = $this->getInitialPackagePairs();

        if ($themePair->getName() !== self::BLANK_THEME) {
            $themeName = $themePair->getName();
            array_push($packagePairs, $themePair);
        }

        $orgDir = getcwd();
        chdir($path);

        $this->fs->mkdir([
            'build',
            'src/layouts',
            'src/content',
            'src/content/posts',
            'src/content/assets',
            'src/includes',
            'src/plugins',
        ]);
        $this->renderFile('site/config.yml.twig', 'config.yml', [
            'theme_name' => $themeName,
        ]);
        $this->renderFile('site/composer.json.twig', 'composer.json', [
            'requires' => $this->generateRequirePackages($packagePairs),
        ]);
        $this->fs->dumpFile('src/content/index.html', '');

        chdir($orgDir);
    }
800947
public function set($theme, $group = null)
    {
        if (!is_null($group)) {
            $this->currentGroup = $group;
            $this->currentTheme[$group] = $theme;
        }

        if (is_null($this->currentGroup)) {
            throw new \Exception('Current group cannot be null. Use Theme::setCurrentGroup($group) or Theme::set($theme, $group)');
        }

        $this->currentTheme[$this->currentGroup] = $theme;

        return $this;
    }
11903
protected function parseTheme(DirectoryInterface $themeDir, array $generalConfig)
    {
        $themeConfig = $this->parseConfigYaml('theme.yml', $themeDir);

        /** @deprecated Deprecated since 3.0, to be removed in 4.0. (config.yml was the old filename) */
        if (empty($themeConfig)) {
            $themeConfig = $this->parseConfigYaml('config.yml', $themeDir);
        }

        if ((isset($themeConfig['templatefields'])) && (is_array($themeConfig['templatefields']))) {
            $templateContentTypes = [];

            foreach ($themeConfig['templatefields'] as $template => $templateFields) {
                $fieldsContenttype = [
                    'fields'        => $templateFields,
                    'singular_name' => 'Template Fields ' . $template,
                ];

                try {
                    $templateContentTypes[$template] = $this->parseContentType(
                        $template,
                        $fieldsContenttype,
                        $generalConfig
                    );
                } catch (InvalidArgumentException $e) {
                    $this->exceptions[] = $e->getMessage();
                }
            }

            $themeConfig['templatefields'] = $templateContentTypes;
        }

        return $themeConfig;
    }
595988
def previous_theme(self):
        
        theme = self.term.theme_list.previous(self.term.theme)
        while not self.term.check_theme(theme):
            theme = self.term.theme_list.previous(theme)

        self.term.set_theme(theme)
        self.draw()
        message = self.term.theme.display_string
        self.term.show_notification(message, timeout=1)
385988
public function setTemplatePathAndFilename($templatePathAndFilename)
    {
        $this->baseRenderingContext->getTemplatePaths()->setTemplatePathAndFilename($templatePathAndFilename);

        $partialRootPaths = $this->baseRenderingContext->getTemplatePaths()->getPartialRootPaths();
        $layoutRootPaths = $this->baseRenderingContext->getTemplatePaths()->getLayoutRootPaths();
        array_unshift($partialRootPaths, Files::concatenatePaths([dirname($templatePathAndFilename), 'Partials']));
        array_unshift($layoutRootPaths, Files::concatenatePaths([dirname($templatePathAndFilename), 'Layouts']));
        $this->baseRenderingContext->getTemplatePaths()->setPartialRootPaths($partialRootPaths);
        $this->baseRenderingContext->getTemplatePaths()->setLayoutRootPaths($layoutRootPaths);
    }
534958
public function Themes($ThemeName = '', $TransientKey = '') {
      $this->AddJsFile('addons.js');
      $this->SetData('Title', T('Themes'));
         
      $this->Permission('Garden.Settings.Manage');
      $this->AddSideMenu('dashboard/settings/themes');
      
      $ThemeInfo = Gdn::ThemeManager()->EnabledThemeInfo(TRUE);
      $this->SetData('EnabledThemeFolder', GetValue('Folder', $ThemeInfo));
      $this->SetData('EnabledTheme', Gdn::ThemeManager()->EnabledThemeInfo());
      $this->SetData('EnabledThemeName', GetValue('Name', $ThemeInfo, GetValue('Index', $ThemeInfo)));
      
      $Themes = Gdn::ThemeManager()->AvailableThemes();
      uasort($Themes, array('SettingsController', '_NameSort'));
      
      // Remove themes that are archived
      $Remove = array();
      foreach ($Themes as $Index => $Theme) {
         $Archived = GetValue('Archived', $Theme);
         if ($Archived)
            $Remove[] = $Index;
      }
      foreach ($Remove as $Index) {
         unset($Themes[$Index]);
      }
      $this->SetData('AvailableThemes', $Themes);
      
      if (Gdn::Session()->ValidateTransientKey($TransientKey) && $ThemeName != '') {
         try {
            $ThemeInfo = Gdn::ThemeManager()->GetThemeInfo($ThemeName);
            if ($ThemeInfo === FALSE)
               throw new Exception(sprintf(T("Could not find a theme identified by '%s'"), $ThemeName));
            
            Gdn::Session()->SetPreference(array('PreviewThemeName' => '', 'PreviewThemeFolder' => '')); // Clear out the preview
            Gdn::ThemeManager()->EnableTheme($ThemeName);
            $this->EventArguments['ThemeName'] = $ThemeName;
            $this->EventArguments['ThemeInfo'] = $ThemeInfo;
            $this->FireEvent('AfterEnableTheme');
         } catch (Exception $Ex) {
            $this->Form->AddError($Ex);
         }
         
         if ($this->Form->ErrorCount() == 0)
            Redirect('/settings/themes');

      }
      $this->Render();
   }
991945
public boolean setCurrentTheme(int theme){
        if (Looper.getMainLooper().getThread() != Thread.currentThread())
            return false;

        if(mCurrentTheme != theme){
            mCurrentTheme = theme;
            SharedPreferences pref = getSharedPreferences(mContext);
            if(pref != null)
                pref.edit().putInt(KEY_THEME, mCurrentTheme).apply();
            dispatchThemeChanged(mCurrentTheme);
            return true;
        }

        return false;
    }
922208
protected function copyContentFromThemeToSite($sitePath, $relativeThemePath)
    {
        if ($this->fs->exists($sitePath.'/'.$relativeThemePath) === false) {
            throw new \RuntimeException('The theme has not been installed correctly.');
        }

        $finder = new Finder();
        $finder->in($sitePath.'/'.$relativeThemePath.'/src/content')
            ->exclude(['assets'])
            ->files();

        foreach ($finder as $file) {
            $this->fs->copy($file->getRealpath(), $sitePath.'/src/content/'.$file->getRelativePathname(), true);
        }
    }