b2in/app/Helpers/ThemeHelper.php
2026-01-23 17:33:10 +01:00

163 lines
4.5 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', 'b2in');
return self::getLogoPathForBrand($theme, $type);
}
/**
* Get the logo path for a specific brand
*/
public static function getLogoPathForBrand(?string $brand = null, string $type = 'positive'): string
{
$brand = $brand ?? config('app.theme', 'b2in');
$logoMap = [
'b2in' => [
'positive' => 'img/logos/b2in-logo-positive.svg',
'negative' => 'img/logos/b2in-logo-negative.svg'
],
'b2a' => [
'positive' => 'img/logos/b2a-logo-positiv.svg',
'negative' => 'img/logos/b2a-logo-negativ.svg'
],
'stileigentum' => [
'positive' => 'img/logos/stileigentum-logo-positiv.svg',
'negative' => 'img/logos/stileigentum-logo-negativ.svg'
],
'style2own' => [
'positive' => 'img/logos/style2own-logo-positiv.svg',
'negative' => 'img/logos/style2own-logo-negativ.svg'
]
];
return $logoMap[$brand][$type] ?? $logoMap['b2in'][$type];
}
/**
* Get the favicon path based on the current theme
*/
public static function getFaviconPath(): string
{
$theme = config('app.theme', 'b2in');
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', 'b2in');
return "resources/css/web/theme-{$theme}.css";
}
/**
* Get domain-specific configuration
*/
public static function getDomainConfig(): array
{
$theme = config('app.theme', 'b2in');
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'] ?? '#2b3f51';
}
/**
* Get secondary color for the current theme
*/
public static function getSecondaryColor(): string
{
$config = self::getDomainConfig();
return $config['color_scheme']['secondary'] ?? '#20a0da';
}
/**
* Get primary font family for the current theme
*/
public static function getPrimaryFont(): string
{
$config = self::getDomainConfig();
return $config['font_family']['primary'] ?? 'Inter';
}
/**
* Get secondary font family for the current theme
*/
public static function getSecondaryFont(): string
{
$config = self::getDomainConfig();
return $config['font_family']['secondary'] ?? 'IBM Plex Sans';
}
/**
* Get domain name for the current theme
*/
public static function getDomainName(): string
{
$config = self::getDomainConfig();
return $config['domain_name'] ?? 'B2IN';
}
public static function getDomainUrl(): string
{
$config = self::getDomainConfig();
return $config['url'] ?? config('app.url');
}
/**
* Get brand colors for a specific brand
*/
public static function getBrandColors(?string $brand = null): array
{
$brand = $brand ?? config('app.theme', 'b2in');
$config = config("domains.domains.{$brand}", []);
return [
'primary' => $config['color_scheme']['primary'] ?? '#2b3f51',
'secondary' => $config['color_scheme']['secondary'] ?? '#20a0da',
'accent' => $config['color_scheme']['accent'] ?? null,
];
}
/**
* Get brand name for a specific brand
*/
public static function getBrandName(?string $brand = null): string
{
$brand = $brand ?? config('app.theme', 'b2in');
$brandNames = [
'b2in' => 'B2IN',
'b2a' => 'B2A',
'stileigentum' => 'StilEigentum',
'style2own' => 'Style2Own',
];
return $brandNames[$brand] ?? strtoupper($brand);
}
/**
* Get all brand configuration for a specific brand
*/
public static function getBrandConfig(?string $brand = null): array
{
$brand = $brand ?? config('app.theme', 'b2in');
return config("domains.domains.{$brand}", []);
}
}