presseportale/app/Helpers/ThemeHelper.php
Kevin Adametz 5b8bdf4182
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
12-05-2026 Frontend dev
2026-05-12 18:32:33 +02:00

124 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', 'portal');
$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['portal'][$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'] ?? 'presseportale.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.presseportale.test',
'presseecho' => 'https://assets.presseecho.test',
'businessportal24' => 'https://assets.businessportal24.test',
];
return $assetUrlMap[$theme] ?? 'https://assets.presseportale.test';
}
}