mirror of
https://github.com/flarum/core.git
synced 2025-08-03 23:17:43 +02:00
Move theme config to database
This commit is contained in:
@@ -14,12 +14,16 @@ class ConfigTableSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
$config = [
|
||||
'api_url' => 'http://flarum.dev/api',
|
||||
'base_url' => 'http://flarum.dev',
|
||||
'forum_title' => 'Flarum Demo Forum',
|
||||
'welcome_message' => 'Flarum is now at a point where you can have basic conversations, so here is a little demo for you to break.',
|
||||
'welcome_title' => 'Welcome to Flarum Demo Forum',
|
||||
'extensions_enabled' => '[]',
|
||||
'api_url' => 'http://flarum.dev/api',
|
||||
'base_url' => 'http://flarum.dev',
|
||||
'forum_title' => 'Flarum Demo Forum',
|
||||
'welcome_message' => 'Flarum is now at a point where you can have basic conversations, so here is a little demo for you to break.',
|
||||
'welcome_title' => 'Welcome to Flarum Demo Forum',
|
||||
'extensions_enabled' => '[]',
|
||||
'theme_primary_color' => '#536F90',
|
||||
'theme_secondary_color' => '#536F90',
|
||||
'theme_dark_mode' => false,
|
||||
'theme_colored_header' => false,
|
||||
];
|
||||
|
||||
DB::table('config')->insert(array_map(function ($key, $value) {
|
||||
|
@@ -9,6 +9,7 @@ use View;
|
||||
use DB;
|
||||
use Flarum\Forum\Events\RenderView;
|
||||
use Flarum\Api\Request as ApiRequest;
|
||||
use Flarum\Core;
|
||||
|
||||
class IndexAction extends BaseAction
|
||||
{
|
||||
@@ -36,7 +37,7 @@ class IndexAction extends BaseAction
|
||||
}
|
||||
|
||||
$view = View::make('flarum.forum::index')
|
||||
->with('title', Config::get('flarum::forum_title', 'Flarum Demo Forum'))
|
||||
->with('title', Core::config('forum_title'))
|
||||
->with('config', $config)
|
||||
->with('layout', 'flarum.forum::forum')
|
||||
->with('data', $data)
|
||||
@@ -49,6 +50,12 @@ class IndexAction extends BaseAction
|
||||
$root.'/js/forum/dist/app.js',
|
||||
$root.'/less/forum/app.less'
|
||||
]);
|
||||
$assetManager->addLess('
|
||||
@fl-primary-color: '.Core::config('theme_primary_color').';
|
||||
@fl-secondary-color: '.Core::config('theme_secondary_color').';
|
||||
@fl-dark-mode: '.(Core::config('theme_dark_mode') ? 'true' : 'false').';
|
||||
@fl-colored_header: '.(Core::config('theme_colored_header') ? 'true' : 'false').';
|
||||
');
|
||||
|
||||
event(new RenderView($view, $assetManager, $this));
|
||||
|
||||
|
Reference in New Issue
Block a user