ldc-gen-game-web/app/Helpers/ThemeHelper.php
2025-08-29 14:58:48 +02:00

34 lines
1,022 B
PHP

<?php
use Illuminate\Support\Facades\Log;
if (!function_exists('themeConfig')) {
/**
* Undocumented function
*
* @return array
* @throws \Exception Folder or config file doesn't exist.
*/
function themeConfig(): array
{
$themeName = tenant()->theme;
$themePath = resource_path("theme/$themeName");
$configFile = "$themePath/theme.config.php";
if (!is_dir($themePath)) {
Log::error("Le dossier du thème [$themeName] est introuvable : $themePath");
throw new \Exception(
"Le dossier du thème [$themeName] est introuvable : $themePath"
);
}
if (!file_exists($configFile)) {
Log::error("Le fichier de config du thème [$themeName] est introuvable : $configFile");
throw new \Exception(
"Le fichier de config du thème [$themeName] est introuvable : $configFile"
);
}
return require $configFile;
}
} //end if