Esempio n. 1
0
 /**
  * Handle the options.
  *
  * @param SelectFieldType $fieldType
  * @param ThemeCollection $themes
  * @param Repository      $config
  * @param Filesystem      $files
  */
 public function handle(SelectFieldType $fieldType, ThemeCollection $themes, Repository $config, Filesystem $files)
 {
     $theme = $themes->get($config->get('streams::themes.standard'));
     $options = $files->allFiles($theme->getPath('resources/views/layouts'));
     $fieldType->setOptions(array_combine(array_map(function ($path) use($theme) {
         return 'theme::' . ltrim(str_replace($theme->getPath('resources/views'), '', $path), '/');
     }, $options), array_map(function ($path) use($theme) {
         return ltrim(str_replace($theme->getPath('resources/views/layouts'), '', $path), '/');
     }, $options)));
 }
 /**
  * Detect the active theme and set up
  * our environment with it.
  */
 public function handle()
 {
     $admin = $this->themes->get($this->config->get('streams::themes.admin'));
     $standard = $this->themes->get($this->config->get('streams::themes.standard'));
     if ($admin) {
         $admin->setActive(true);
     }
     if ($standard) {
         $standard->setActive(true);
     }
     if ($admin && in_array($this->request->segment(1), ['installer', 'admin'])) {
         $admin->setCurrent(true);
     } elseif ($standard) {
         $standard->setCurrent(true);
     }
     if ($theme = $this->themes->current()) {
         $this->view->addNamespace('theme', $theme->getPath('resources/views'));
         $this->translator->addNamespace('theme', $theme->getPath('resources/lang'));
         $this->asset->addPath('theme', $theme->getPath('resources'));
         $this->image->addPath('theme', $theme->getPath('resources'));
     }
 }