Added ability to have per user color themes in CP

This commit is contained in:
Pinga 2025-04-25 13:34:00 +03:00
parent 6413515e75
commit 5b39a7fc19
5 changed files with 153 additions and 47 deletions

View file

@ -222,4 +222,15 @@ class HomeController extends Controller
}
return $response->withHeader('Location', '/dashboard')->withStatus(302);
}
public function selectTheme(Request $request, Response $response)
{
global $container;
$data = $request->getParsedBody();
$_SESSION['_theme'] = ($v = substr(trim(preg_replace('/[^\x20-\x7E]/', '', $data['theme-primary'] ?? '')), 0, 30)) !== '' ? $v : 'blue';
$container->get('flash')->addMessage('success', 'Theme color has been set successfully');
return $response->withHeader('Location', '/profile')->withStatus(302);
}
}