<?phpnamespace Aviatur\GeneralBundle\Twig;use Doctrine\ORM\EntityManagerInterface;use Symfony\Component\HttpFoundation\Session\SessionInterface;use Twig\Extension\AbstractExtension;use Twig\Extension\GlobalsInterface;use Aviatur\GeneralBundle\Entity\ConfigAgencyStyles;class TailwindConfig extends AbstractExtension implements GlobalsInterface{ private array $tailwindConfig = []; public function __construct(EntityManagerInterface $em, SessionInterface $session) { $agencyId = $session->has('agencyId') ? $session->get('agencyId') : null; $configRepo = $em->getRepository(ConfigAgencyStyles::class); // Try to find specific agency config $configEntity = $configRepo->findOneBy(['agency' => $agencyId]); // If specific config not found and we weren't already looking for the default (agencyId=null), try the default if (!$configEntity && $agencyId !== null) { $configEntity = $configRepo->findOneBy(['agency' => null]); } if ($configEntity) { $this->tailwindConfig = $configEntity->getConfig(); } else { // Default config (if no agency or no config in DB) $this->tailwindConfig = [ 'theme' => [ 'extend' => [ 'screens' => [ 'xs' => ['max' => '575px'], 's' => ['min' => '576px', 'max' => '767px'], 'm' => ['min' => '768px', 'max' => '992px'], 'l' => ['min' => '993px'], 'phone' => ['min' => '320px'], 'tablet'=> ['min' => '721px'], 'desk' => ['min' => '951px'], 'wide' => ['min' => '1750px'], ], 'colors' => [ 'primaryEmphasis' => [ 400 => '#4D95EB', 300 => '#7AB5F5', 200 => '#A3CEFC', 100 => '#C6E2FF', 50 => '#E3F1FF', 25 => '#F0F7FF', ], 'secondaryStrong' => [ 900 => '#072E50', 800 => '#09325F', 700 => '#003D78', 600 => '#004C98', ], 'grayScales' => [ 900 => '#3A3A3A', 800 => '#5A5A5A', 700 => '#727272', 600 => '#8B8B8B', 500 => '#B1B1B1', 400 => '#D1D1D1', 300 => '#D9D9D9', 200 => '#EBEBEB', 100 => '#F0F0F0', 50 => '#FCFCFC', ], 'success' => [ 900 => '#045044', 800 => '#036251', 700 => '#007C66', 600 => '#008F72', 400 => '#2FDBAC', 300 => '#6AEBC6', 200 => '#A4F6D9', 100 => '#D0FBEA', 50 => '#EBFEF7', ], 'warning' => [ 900 => '#783716', 800 => '#954117', 700 => '#BC5312', 500 => '#F28C28', 400 => '#F5A242', 300 => '#F8C579', 200 => '#FBDEAD', 100 => '#FEF0D6', 50 => '#FEF8EE', ], 'error' => [ 900 => '#7D1F1F', 800 => '#971D1D', 600 => '#D92929', 500 => '#EC4747', 400 => '#F67373', 300 => '#FAA7A7', 200 => '#FDCBCB', 100 => '#FEE2E2', 50 => '#FEF2F2', ], 'additionalDarkMode' => [ 0 => '#F5F7F9', 900 => '#0E1A23', 950 => '#0D141A', ], 'fundamentals' => [ 'white' => '#FFFFFF', 'black' => '#000000', ], 'mainWarning' => '#E36C13', 'mainError' => '#AC1D1D', 'textParagraph' => '#2F2F2F', 'primary' => '#005CB9', 'secondary' => '#042A44', 'action' => '#0ABF96', ], ] ], 'plugins' => [] ]; } } public function getGlobals(): array { return [ 'tailwind_config' => $this->tailwindConfig ]; }}