vendor/pimcore/pimcore/lib/Twig/Extension/WebsiteConfigExtension.php line 47

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * Pimcore
  5.  *
  6.  * This source file is available under two different licenses:
  7.  * - GNU General Public License version 3 (GPLv3)
  8.  * - Pimcore Commercial License (PCL)
  9.  * Full copyright and license information is available in
  10.  * LICENSE.md which is distributed with this source code.
  11.  *
  12.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  13.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  14.  */
  15. namespace Pimcore\Twig\Extension;
  16. use Pimcore\Config;
  17. use Twig\Extension\AbstractExtension;
  18. use Twig\TwigFunction;
  19. /**
  20.  * @internal
  21.  */
  22. class WebsiteConfigExtension extends AbstractExtension
  23. {
  24.     public function getFunctions(): array
  25.     {
  26.         return [
  27.             new TwigFunction('pimcore_website_config', [$this'getWebsiteConfig']),
  28.         ];
  29.     }
  30.     /**
  31.      * Returns website config for the current site
  32.      *
  33.      * @param string|null $key  Config key to directly load. If null, the whole config will be returned
  34.      * @param mixed $default    Default value to use if the key is not set
  35.      * @param string|null $language
  36.      *
  37.      * @return mixed
  38.      */
  39.     public function getWebsiteConfig($key null$default null$language null): mixed
  40.     {
  41.         return Config::getWebsiteConfigValue($key$default$language);
  42.     }
  43. }