presseportale/app/Helpers/ThemeHelper.php
Kevin Adametz 405df0a122
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
first commit
2025-10-20 17:53:02 +02:00

117 lines
3.1 KiB
PHP

<?php
namespace App\Helpers;
class ThemeHelper
{
/**
* Get the logo path based on the current theme
*/
public static function getLogoPath(string $type = 'positive'): string
{
$theme = config('app.theme', 'pr-copilot');
$logoMap = [
'portal' => [
'positive' => 'img/logos/portal-logo-positive.svg',
'negative' => 'img/logos/portal-logo-negative.svg'
],
'presseecho' => [
'positive' => 'img/logos/presseecho-logo-positiv.svg',
'negative' => 'img/logos/presseecho-logo-negativ.svg'
],
'businessportal24' => [
'positive' => 'img/logos/businessportal24-logo-positiv.svg',
'negative' => 'img/logos/businessportal24-logo-negativ.svg'
]
];
return $logoMap[$theme][$type] ?? $logoMap['pr-copilot'][$type];
}
/**
* Get the favicon path based on the current theme
*/
public static function getFaviconPath(): string
{
$theme = config('app.theme', 'portal');
return "img/favicons/{$theme}-favicon.ico";
}
/**
* Get the CSS theme file based on the current theme
*/
public static function getThemeCssPath(): string
{
$theme = config('app.theme', 'portal');
return "resources/css/web/theme-{$theme}.css";
}
/**
* Get domain-specific configuration
*/
public static function getDomainConfig(): array
{
$theme = config('app.theme', 'portal');
return config("domains.domains.{$theme}", []);
}
/**
* Get primary color for the current theme
*/
public static function getPrimaryColor(): string
{
$config = self::getDomainConfig();
return $config['color_scheme']['primary'] ?? '#526266';
}
/**
* Get secondary color for the current theme
*/
public static function getSecondaryColor(): string
{
$config = self::getDomainConfig();
return $config['color_scheme']['secondary'] ?? '#82a0a7';
}
/**
* Get primary font family for the current theme
*/
public static function getFont(): string
{
$config = self::getDomainConfig();
return $config['font'] ?? 'Montserrat';
}
/**
* Get domain name for the current theme
*/
public static function getDomainName(): string
{
$config = self::getDomainConfig();
return $config['domain_name'] ?? 'pr-copilot.test';
}
public static function getDomainUrl(): string
{
$config = self::getDomainConfig();
return $config['url'] ?? config('app.url');
}
/**
* Get the asset URL (Vite dev server) for the current theme
*/
public static function getAssetUrl(): string
{
$theme = config('app.theme', 'portal');
$assetUrlMap = [
'portal' => 'https://assets.pr-copilot.test',
'presseecho' => 'https://assets.presseecho.test',
'businessportal24' => 'https://assets.businessportal24.test',
];
return $assetUrlMap[$theme] ?? 'https://assets.pr-copilot.test';
}
}