관리자가 모든 모듈의 다크모드 설정을 제어하도록 합니다. (#1558)

* 관리자가 다크모드 작동 여부를 선택할 수 있도록 수정
This commit is contained in:
Min-Soo Kim 2021-01-10 22:21:13 +09:00 committed by GitHub
parent b7856e5683
commit 899fe00dda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 75 additions and 9 deletions

View file

@ -223,6 +223,7 @@ class ModuleHandler extends Handler
$this->mid = $module_info->mid;
$this->module_info = $module_info;
$this->_setModuleSEOInfo($module_info, $site_module_info);
$this->_setModuleColorScheme($site_module_info);
// Check if the current request is from a mobile device.
$this->is_mobile = Mobile::isFromMobilePhone();
@ -753,6 +754,29 @@ class ModuleHandler extends Handler
return $module_info;
}
/**
* Set color scheme.
*
* @param object $site_module_info
*/
protected function _setModuleColorScheme($site_module_info)
{
$color_scheme = null;
$color_scheme_array = array('off_light'=>'light', 'off_dark' => 'dark');
if (isset($color_scheme_array[$site_module_info->settings->color_scheme]))
{
Rhymix\Framework\UA::setColorScheme('auto');
$color_scheme = $color_scheme_array[$site_module_info->settings->color_scheme];
Context::addBodyClass('color_scheme_' . $color_scheme);
}
elseif (($color_scheme = Rhymix\Framework\UA::getColorScheme()) !== 'auto')
{
Context::addBodyClass('color_scheme_' . $color_scheme);
}
}
/**
* Set SEO information to Context.
*