/**
  * Return the settings form for the admin theme.
  *
  * @param SettingFormBuilder $settings
  * @param ThemeCollection    $themes
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function settings(SettingFormBuilder $settings, ThemeCollection $themes)
 {
     if ($theme = $themes->activeAdmin()) {
         $settings->setOption('title', trans('module::message.active_theme', ['theme' => trans($theme->getName())]));
     }
     return $settings->render(config('streams::themes.admin.active'));
 }
 /**
  * Handle the command.
  *
  * @param ModuleCollection $modules
  * @param ThemeCollection  $themes
  */
 public function handle(ModuleCollection $modules, ThemeCollection $themes)
 {
     $theme = $themes->current();
     /*
      * Default the form view based on the request.
      */
     if (!$this->builder->getFormOption('form_view') && $this->builder->isAjax()) {
         $this->builder->setFormOption('form_view', 'streams::form/ajax');
     }
     if (!$this->builder->getFormOption('form_view') && $theme && $theme->isAdmin()) {
         $this->builder->setFormOption('form_view', 'streams::form/form');
     }
     if (!$this->builder->getFormOption('form_view') && $theme && !$theme->isAdmin()) {
         $this->builder->setFormOption('form_view', 'streams::form/standard');
     }
     if (!$this->builder->getFormOption('form_view')) {
         $this->builder->setFormOption('form_view', 'streams::form/admin/form');
     }
     /*
      * Default the form wrapper view as well.
      */
     if (!$this->builder->getFormOption('wrapper_view') && $this->builder->isAjax()) {
         $this->builder->setFormOption('wrapper_view', 'streams::ajax');
     }
     if (!$this->builder->getFormOption('wrapper_view')) {
         $this->builder->setFormOption('wrapper_view', 'streams::blank');
     }
     /*
      * If the permission is not set then
      * try and automate it.
      */
     if ($this->builder->getFormOption('permission') === null && ($module = $modules->active()) && ($stream = $this->builder->getFormStream())) {
         $this->builder->setFormOption('permission', $module->getNamespace($stream->getSlug() . '.write'));
     }
 }
 /**
  * Handle the command.
  *
  * @param Repository      $config
  * @param ThemeCollection $themes
  */
 public function handle(Repository $config, ThemeCollection $themes)
 {
     if (!($theme = $themes->current())) {
         return;
     }
     foreach ($config->get($theme->getNamespace('variables'), []) as $key => $value) {
         $this->variables->put($key, $value);
     }
 }
 /**
  * Handle the command.
  *
  * @param Dispatcher      $events
  * @param Repository      $config
  * @param ThemeCollection $themes
  */
 public function handle(Dispatcher $events, Repository $config, ThemeCollection $themes)
 {
     if (!($theme = $themes->current())) {
         return;
     }
     foreach ($config->get($theme->getNamespace('variables'), []) as $key => $value) {
         $this->variables->put($key, $value);
     }
     $events->fire(new ThemeVariablesHaveLoaded($this->variables));
 }
Exemplo n.º 5
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)));
 }
Exemplo n.º 6
0
 /**
  * Handle the command.
  *
  * @param SettingRepositoryInterface $settings
  * @param ThemeCollection            $themes
  * @param Repository                 $config
  */
 public function handle(SettingRepositoryInterface $settings, ThemeCollection $themes, Repository $config)
 {
     if (!($theme = $themes->current())) {
         return;
     }
     if (!($fields = $config->get($theme->getNamespace('settings/settings')))) {
         $fields = $config->get($theme->getNamespace('settings'));
     }
     if (!$fields) {
         return;
     }
     foreach (array_keys($fields) as $field) {
         $this->variables->put($field, $settings->get($theme->getNamespace($field), array_get($fields, $field . '.config.default_value')));
     }
 }
 /**
  * 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'));
     }
 }