Create a new theme

@link   https://help.shopify.com/api/reference/theme#create
@param  Theme $theme
@return void
357125
public function create(Theme &$theme)
    {
        $data = $theme->exportData();
        $endpoint = '/admin/themes.json';
        $response = $this->request(
            $endpoint, 'POST', array(
            'theme' => $data
            )
        );
        $theme->setData($response['theme']);
    }
62859
public function hasTheme($theme)
    {
        if (is_dir($this->getThemesDir() . $theme)) {
            return true;
        } else {
            foreach (modules() as $module) {
                if (in_array($module->getType(), ['KERNEL', 'FRAMEWORK'])) {
                    continue;
                } elseif (is_dir($module->getResourcesDir('themes') . $theme)) {
                    return true;
                }
            }
        }

        return false;
    }
760733
public function reload_theme() {
        if (!is_null($this->_theme)) {
            $this->_theme = theme_config::load($this->_theme->name);
        }
    }
1117940
public function update(Theme &$theme)
    {
        $data = $theme->exportData();
        $endpoint = '/admin/themes/'.$theme->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'theme' => $data
            )
        );
        $theme->setData($response['theme']);
    }
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);
    }
839597
public function setTheme($theme = 'light')
    {
        if (in_array($theme, self::$themes))
            $this->theme = $theme;
        else
            throw new \Exception('Theme "'.$theme.'"" is not supported. Available themes : '.join(', ', self::$themes));

        return $this;
    }
607273
private function callback($theme, $method, $data)
	{
		if ($theme == NULL)
			throw new CHttpException(400, Yii::t('Api.Theme', 'Missing Theme'));

		if ($method == NULL)
			throw new CHttpException(400, Yii::t('Api.Theme', 'Method name is missing'));

		Yii::import('base.themes.' . $theme . '.Theme');
		$theme = new Theme;

		if (method_exists($theme, $method))
			return $theme->$method($data);

		throw new CHttpException(404, Yii::t('Api.Theme', 'Missing callback method.'));
	}
892273
public static function init_config($theme_root = null)
    {
        if (static::$setup === false) {
            $config = new Config();

            if ($theme_root === null) {
                $config_cache_path = \get_stylesheet_directory() . '/cache/config/' . \sha1(NONCE_SALT . 'theme');

                if (WP_DEBUG === false && \file_exists($config_cache_path)) {
                    $config->load_from_cache(\file_get_contents($config_cache_path));
                } else {
                    $config->add_path(\get_template_directory() . '/config');

                    if (\is_child_theme()) {
                        $config->add_path(\get_stylesheet_directory() . '/config');
                    }
                }
            }

            if ($theme_root !== null) {
                $config->add_path($theme_root . '/config');
            }

            static::$container->add_instance($config);
            static::$container->alias(Config::class, 'config');
        }
    }
1102578
static function setCurrent($theme = null) {
        //удалить все невостребованные классы тем оформления
        foreach(self::getThemes() as $t) {
            \LaraPage::body()->removeClass(self::getClassTheme($t));
        }
        //добавить класс текущей темы оформления
        \LaraPage::body()->addClass(self::getClassTheme($theme));
        self::$current = $theme;
        \Twig::addGlobal('current_theme', $theme);
    }
467774
public function exists($themeName)
    {
        foreach ($this->themes as $theme) {
            if ($theme->name == $themeName) {
                return true;
            }

        }
        return false;
    }
44787
public function setTheme($theme, array $mods = [], array $options = [], array $menus = [], array $sidebars = [])
    {
        $this->setOptions($options);
        switch_theme($theme);
        $this->setThemeMods($mods);
        $this->createMenus($menus);
        $this->setupSidebars($sidebars);
    }
344301
public function setThemeByRoute($path, $theme = null, $wrapper = FILENAME_THEMES_VIEW)
    {
        $app = Application::getFacadeApplication();
        $app->make(ThemeRouteCollection::class)->setThemeByRoute($path, $theme, $wrapper);
    }
316492
public static void setDefaultTheme(int theme) {
        ThemeManager._DEFAULT_THEME = theme;
        if (theme < _START_RESOURCES_ID) {
            ThemeManager._DEFAULT_THEME &= ThemeManager._THEME_MASK;
        }
    }
157658
public function createThemePath($module = null, $theme = null)
    {
        return $this->createSharedThemePath($module, $theme, $this->moduleDir);
    }
1280567
protected function secondaryTheme($theme=null) {
        
        if($theme) {
            $this->origin = $this->container->getThemeActivated();
            $this->container->setThemeActivated($theme);
        }
        
    }
241744
protected function append_theme_actions_content( $theme ) {
		$details_url       = esc_attr(
			add_query_arg(
				[
					'tab'       => 'theme-information',
					'theme'     => $theme->slug,
					'TB_iframe' => 'true',
					'width'     => 270,
					'height'    => 400,
				],
				self_admin_url( 'theme-install.php' )
			)
		);
		$nonced_update_url = wp_nonce_url(
			$this->get_update_url( 'theme', 'upgrade-theme', $theme->slug ),
			'upgrade-theme_' . $theme->slug
		);

		$current = get_site_transient( 'update_themes' );

		/**
		 * Display theme update links.
		 */
		ob_start();
		if ( isset( $current->response[ $theme->slug ] ) ) {
			?>
			<p>
				<strong>
					<?php
					printf(
						/* translators: %s: theme name */
						esc_html__( 'There is a new version of %s available.', 'github-updater' ),
						$theme->name
					);
					printf(
						' <a href="%s" class="thickbox open-plugin-details-modal" title="%s">',
						$details_url,
						esc_attr( $theme->name )
					);
					printf(
						/* translators: 1: version number, 2: closing anchor tag, 3: update URL */
						esc_html__( 'View version %1$s details%2$s or %3$supdate now%2$s.', 'github-updater' ),
						$theme->remote_version = isset( $theme->remote_version ) ? $theme->remote_version : null,
						'</a>',
						sprintf(
							/* translators: %s: theme name */
							'<a aria-label="' . esc_html__( 'Update %s now', 'github-updater' ) . '" id="update-theme" data-slug="' . $theme->slug . '" href="' . $nonced_update_url . '">',
							$theme->name
						)
					);
					?>
				</strong>
			</p>
			<?php
		}

		return trim( ob_get_clean(), '1' );
	}
1099061
public function setThemeTemplate($template)
    {
        $this->_themeTemplate = $template;
        if ($this->getTheme() != null) {
            $this->getTheme()->setTemplate($this->_themeTemplate);
        }
    }