Get all themes for a form select input.

@return array
359324
public static function getThemesForSelect()
    {
        if (!self::$_initialized) {
            self::init();
        }

        $results = [];
        foreach (self::$_themes as $theme) {
            $results[$theme->id()] = $theme->name();
        }

        return $results;
    }
423603
public static function get_filter_options() {
        $manager = \core_plugin_manager::instance();
        $themes = $manager->get_installed_plugins('theme');

        $options = [];
        foreach (array_keys($themes) as $themename) {
            try {
                $theme = \theme_config::load($themename);
            } catch (Exception $e) {
                // Bad theme, just skip it for now.
                continue;
            }
            if ($themename !== $theme->name) {
                // Obsoleted or broken theme, just skip for now.
                continue;
            }
            if ($theme->hidefromselector) {
                // The theme doesn't want to be shown in the theme selector and as theme
                // designer mode is switched off we will respect that decision.
                continue;
            }
            $options[$theme->name] = get_string('pluginname', "theme_{$theme->name}");
        }
        return $options;
    }
914222
public function getStylesheets()
    {
        $stylesheets = '';
        foreach ($this->stylesheets as $stylesheet) {
            $stylesheets .= $stylesheet . "\n";
        }
        $stylesheets = rtrim($stylesheets, "\n");
        return $stylesheets;
    }
1239970
public static function themes()
    {
        $themesUri = self::root() . '/style/';
        $themes = array();
        foreach (glob($themesUri . '/*.css') as $css) {
            $fn = trim(preg_replace("%.*/%", '', $css));
            switch ($fn) {
                // these are special, exclude these
                case 'luminous.css':
                case 'luminous_print.css':
                case 'luminous.min.css':
                    continue;
                default:
                    $themes[] = $fn;
            }
        }
        return $themes;
    }
226374
public function getActiveThemes()
    {
        $themes = &gplcart_static('module.active.themes');

        if (isset($themes)) {
            return $themes;
        }

        $themes = array($this->config->get('theme_backend', 'backend'));

        if (!$this->db->isInitialized()) {
            return $themes;
        }

        $stores = $this->db->fetchAll('SELECT * FROM store', array());

        foreach ($stores as $store) {
            $data = unserialize($store['data']);
            foreach ($data as $key => $value) {
                if (strpos($key, 'theme') === 0) {
                    $themes[] = $value;
                }
            }
        }

        return $themes;
    }
904715
public function getCss()
    {
        if (isset($this->_themeConfig['css'])) {
            return array_merge($this->_themeConfig['css'], $this->_data['css']);
        } else {
            return $this->_data['css'];
        }
    }
1001551
public function index()
    {
        $themes = plugin()
            ->filter(function ($plugin) {
                return $plugin->isTheme;
            });

        $frontThemes = $themes
            ->filter(function ($theme) {
                return !isset($theme->composer['extra']['admin']) || !$theme->composer['extra']['admin'];
            })
            ->sortBy(function ($theme) {
                if ($theme->name() === option('front_theme')) {
                    return 0;
                }

                return 1;
            }, SORT_ASC);

        $backThemes = $themes
            ->filter(function ($theme) {
                return isset($theme->composer['extra']['admin']) && $theme->composer['extra']['admin'];
            })
            ->sortBy(function ($theme) {
                if ($theme->name() === option('back_theme')) {
                    return 0;
                }

                return 1;
            }, SORT_ASC);

        $frontCount = count($frontThemes->toArray());
        $backCount = count($backThemes->toArray());

        $this->title(__d('system', 'Themes'));
        $this->_awaitingPlugins('theme');
        $this->set(compact('frontCount', 'backCount', 'frontThemes', 'backThemes'));
        $this->Breadcrumb->push('/admin/system/themes');
    }
9667
public function get_regions() {
        if (is_null($this->defaultregion)) {
            $this->page->initialise_theme_and_output();
        }
        return array_keys($this->regions);
    }
230023
public function all()
    {
        $themes = [];

        if ($this->files->exists($path)) {
            $scannedThemes = $this->files->directories($path);
            foreach ($scannedThemes as $theme) {
                $themes[] = basename($theme);
            }
        }
        return new Collection($themes);
    }
638489
public function getSettings()
    {
        $settings = Settings::all()->keyBy('settingsKey');

        $settings['defaultLanguage'] = (object) array('value' => Language::getDefault()->languageID);

        if(isset($settings['logo'])) {
            $media = Media::where('mediaID', $settings['logo']->value)->select("mediaID", "type", "filename", "fileDirectory")->first();
            if ($media) {
                $settings['logo']['media'] = $media;
            }
            $watermark = Media::where('mediaID', $settings['watermark']->value)->select("mediaID", "type", "filename", "fileDirectory")->first();
            if ($watermark) {
                $settings['watermark']['media'] = $watermark;
            }
        }
        // user groups
        $userGroups = UserGroup::all();
        // get all posts
        $posts = DB::table('post_pages')->select("postID", "title", "slug")->get();
        $posts = Language::filterRows($posts, false);
        // theme configs
        $themeConfigs = Theme::configs();

        return [
            'settings' => $settings,
            'userGroups' => $userGroups,
            'pages' => $posts,
            'themeConfigs' => $themeConfigs,
        ];
    }
1047624
public function all()
    {
        $colors = [];

        foreach ($this->colors as $color => $code) {
            $colors['background_' . $color] = $code + self::ADD;
        }

        return $colors;
    }
871425
public function editAction()
    {
        $themeId = $this->getEvent()->getRouteMatch()->getParam('themeId');
        $theme = $this->getAdminThemeService()->findById($themeId);

        $form = $this->getServiceLocator()->get('playgrounddesign_theme_form');

        $request = $this->getRequest();

        $form->bind($theme);

        if ($request->isPost()) {
            $data = array_merge(
                $request->getPost()->toArray(),
                $request->getFiles()->toArray()
            );

            $theme = $this->getAdminThemeService()->edit($data, $theme, 'playgrounddesign_theme_form');

            if ($theme) {
                $this->flashMessenger()->addMessage('The theme "'.$theme->getTitle().'" was updated');

                return $this->redirect()->toRoute('admin/playgrounddesign_themeadmin');
            } else {
                $this->flashMessenger()->addMessage('The theme was not updated');

                return $this->redirect()->toRoute('admin/playgrounddesign_themeadmin');
            }
        }

        $viewModel = new ViewModel();
        $viewModel->setTemplate('playground-design/theme-admin/theme');

        return $viewModel->setVariables(array('form'           => $form,
                                              'automaticTheme' => 0));
    }
494557
public function getThemes()
    {
        $json = $this->container->json;

        if (null === $definition = $json->getJson(ROOT_DIR . 'structure/definitions/themes.json', 'themes')) {
            throw new Exception('PitonCMS: Get themes exception: ' . implode($json->getErrorMessages(), ','));
        }

        return array_column($definition->themes, 'name', 'value');
    }
317156
public function getActiveThemesList()
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();

        $activeThemeList = [];
        if (!$this->isAdmin()) {
            $activeThemeList[] = $config->getConfigParam('sTheme');

            if ($customThemeId = $config->getConfigParam('sCustomTheme')) {
                $activeThemeList[] = $customThemeId;
            }
        }

        return $activeThemeList;
    }
977417
public function getUpdatableThemes()
    {
        $items = [];
        $repository = $this->repository['themes'];

        // local cache to speed things up
        if (isset($this->cache[__METHOD__])) {
            return $this->cache[__METHOD__];
        }

        foreach ($this->installed['themes'] as $slug => $plugin) {
            if (!isset($repository[$slug]) || $plugin->symlink || !$plugin->version || $plugin->gpm === false) {
                continue;
            }

            $local_version = $plugin->version ?: 'Unknown';
            $remote_version = $repository[$slug]->version;

            if (version_compare($local_version, $remote_version) < 0) {
                $repository[$slug]->available = $remote_version;
                $repository[$slug]->version = $local_version;
                $repository[$slug]->type = $repository[$slug]->release_type;
                $items[$slug] = $repository[$slug];
            }
        }

        $this->cache[__METHOD__] = $items;

        return $items;
    }
1308816
public function stylesAll(): array
    {
        $styles = [];
        foreach ($this->getAll() as $name => $plugin) {
            $styles[$name] = $plugin->styles();
        }
        return $styles;
    }
157751
public function getElementsForSearch()
    {
        $oldThemes = SSViewer::get_themes();
        SSViewer::set_themes(SSViewer::config()->get('themes'));
        try {
            $output = [];
            foreach ($this->owner->hasOne() as $key => $class) {
                if ($class !== ElementalArea::class) {
                    continue;
                }
                /** @var ElementalArea $area */
                $area = $this->owner->$key();
                if ($area) {
                    $output[] = strip_tags($area->forTemplate());
                }
            }
        } finally {
            // Reset theme if an exception occurs, if you don't have a
            // try / finally around code that might throw an Exception,
            // CMS layout can break on the response. (SilverStripe 4.1.1)
            SSViewer::set_themes($oldThemes);
        }
        return implode($output);
    }