src/Content/Controller/IconsController.php line 33

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace App\Content\Controller;
  3. use App\Base\Controller\BaseController;
  4. use App\Content\Repository\Infrastructure\InfrastructureTypeRepository;
  5. use App\Main\Repository\ViewSettingsRepository;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class IconsController extends BaseController
  10. {
  11.     #[Route(path'/infrastructure-icons/icon/{type}'name'infrastructure-icons:icon')]
  12.     public function icon(
  13.         Request $request,
  14.         string $type,
  15.         ViewSettingsRepository $viewSettingsRepository,
  16.     ): Response {
  17.         $viewSettings $viewSettingsRepository->getOrCreate();
  18.         $response $this->render("_parts/icons/infrastructure-icons/infrastructure-icon-{$type}.svg.twig", [
  19.             'pathColor' => $viewSettings->getColorAdd04(),
  20.             'circleColor' => $viewSettings->getColorMain01()
  21.         ]);
  22.         $response->headers->set('Content-Type''image/svg+xml');
  23.         return $response;
  24.     }
  25.     #[Route(path'/infrastructure-icons/icon-negative/{type}'name'infrastructure-icons:icon-negative')]
  26.     public function iconNegative(
  27.         Request $request,
  28.         string $type,
  29.         ViewSettingsRepository $viewSettingsRepository,
  30.     ): Response {
  31.         $viewSettings $viewSettingsRepository->getOrCreate();
  32.         $response $this->render("_parts/icons/infrastructure-icons/infrastructure-icon-{$type}.svg.twig", [
  33.             'circleColor' => $viewSettings->getColorAdd04(),
  34.             'pathColor' => $viewSettings->getColorMain01()
  35.         ]);
  36.         $response->headers->set('Content-Type''image/svg+xml');
  37.         return $response;
  38.     }
  39. }