vendor/shopware/storefront/Framework/Twig/TemplateConfigAccessor.php line 39

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Storefront\Framework\Twig;
  3. use Shopware\Core\Framework\Log\Package;
  4. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  5. use Shopware\Core\System\SystemConfig\SystemConfigService;
  6. use Shopware\Storefront\Theme\ThemeConfigValueAccessor;
  7. #[Package('storefront')]
  8. class TemplateConfigAccessor
  9. {
  10.     /**
  11.      * @internal
  12.      */
  13.     public function __construct(private readonly SystemConfigService $systemConfigService, private readonly ThemeConfigValueAccessor $themeConfigAccessor)
  14.     {
  15.     }
  16.     /**
  17.      * @return string|bool|array|float|int|null
  18.      */
  19.     public function config(string $key, ?string $salesChannelId)
  20.     {
  21.         $static $this->getStatic();
  22.         if (\array_key_exists($key$static)) {
  23.             return $static[$key];
  24.         }
  25.         return $this->systemConfigService->get($key$salesChannelId);
  26.     }
  27.     /**
  28.      * @return string|bool|array|float|int|null
  29.      */
  30.     public function theme(string $keySalesChannelContext $context, ?string $themeId)
  31.     {
  32.         return $this->themeConfigAccessor->get($key$context$themeId);
  33.     }
  34.     private function getStatic(): array
  35.     {
  36.         return [
  37.             'seo.descriptionMaxLength' => 255,
  38.             'cms.revocationNoticeCmsPageId' => '00B9A8636F954277AE424E6C1C36A1F5',
  39.             'cms.taxCmsPageId' => '00B9A8636F954277AE424E6C1C36A1F5',
  40.             'cms.tosCmsPageId' => '00B9A8636F954277AE424E6C1C36A1F5',
  41.             'confirm.revocationNotice' => true,
  42.         ];
  43.     }
  44. }