<?php declare(strict_types=1);
namespace App\Content\Controller;
use App\Base\Controller\BaseController;
use App\Content\Repository\Infrastructure\InfrastructureTypeRepository;
use App\Main\Repository\ViewSettingsRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class IconsController extends BaseController
{
#[Route(path: '/infrastructure-icons/icon/{type}', name: 'infrastructure-icons:icon')]
public function icon(
Request $request,
string $type,
ViewSettingsRepository $viewSettingsRepository,
): Response {
$viewSettings = $viewSettingsRepository->getOrCreate();
$response = $this->render("_parts/icons/infrastructure-icons/infrastructure-icon-{$type}.svg.twig", [
'pathColor' => $viewSettings->getColorAdd04(),
'circleColor' => $viewSettings->getColorMain01()
]);
$response->headers->set('Content-Type', 'image/svg+xml');
return $response;
}
#[Route(path: '/infrastructure-icons/icon-negative/{type}', name: 'infrastructure-icons:icon-negative')]
public function iconNegative(
Request $request,
string $type,
ViewSettingsRepository $viewSettingsRepository,
): Response {
$viewSettings = $viewSettingsRepository->getOrCreate();
$response = $this->render("_parts/icons/infrastructure-icons/infrastructure-icon-{$type}.svg.twig", [
'circleColor' => $viewSettings->getColorAdd04(),
'pathColor' => $viewSettings->getColorMain01()
]);
$response->headers->set('Content-Type', 'image/svg+xml');
return $response;
}
}