presseportale/app/Helpers/ThemeHelper.php
Kevin Adametz 58c773b153 web: Domain-spezifische Favicons und App-Icons für alle drei Marken (R5.4)
Eigene Icon-Sets unter public/icons/{pressekonto,presseecho,businessportal24}
(SVG-Favicon + Touch-/App-Icons); ThemeHelper mappt das aktive Theme auf den
Icon-Ordner (Portal/Admin nutzt den pressekonto-Satz), alle Layout-Heads
binden Favicon + apple-touch-icon domain-abhängig ein.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 07:50:21 +00:00

155 lines
4.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',
],
'pressekonto' => [
'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];
}
/**
* Map the current theme to its icon folder under public/icons.
*
* Das Portal-/Admin-Theme läuft auf pressekonto.test und nutzt daher
* den pressekonto-Iconsatz.
*/
public static function getIconFolder(): string
{
$theme = config('app.theme', 'portal');
$folderMap = [
'portal' => 'pressekonto',
'pressekonto' => 'pressekonto',
'presseecho' => 'presseecho',
'businessportal24' => 'businessportal24',
];
return $folderMap[$theme] ?? 'pressekonto';
}
/**
* Get the favicon (SVG) path based on the current theme.
*/
public static function getFaviconPath(): string
{
return 'icons/'.self::getIconFolder().'/favicon.svg';
}
/**
* Get the larger app/touch icon (SVG) path based on the current theme.
*/
public static function getAppIconPath(): string
{
return 'icons/'.self::getIconFolder().'/icon.svg';
}
/**
* 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'] ?? 'pressekonto.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.pressekonto.test',
'pressekonto' => 'https://assets.pressekonto.test',
'presseecho' => 'https://assets.presseecho.test',
'businessportal24' => 'https://assets.businessportal24.test',
];
return $assetUrlMap[$theme] ?? 'https://assets.pressekonto.test';
}
}